Answered

write data to header file

How abou the following? % Sample data data = rand(1,800); % Arrange it to comma-separated string str = num2str(data); str...

write data to header file

How abou the following? % Sample data data = rand(1,800); % Arrange it to comma-separated string str = num2str(data); str...

ongeveer 2 maanden ago | 1

| accepted

Answered

How to convert 3d monthly data into season

How about the following? % Sample data Data = rand(56,42,360); % Reshape the data so that each row shows monthly data (42*5...

How to convert 3d monthly data into season

How about the following? % Sample data Data = rand(56,42,360); % Reshape the data so that each row shows monthly data (42*5...

ongeveer 2 maanden ago | 1

| accepted

Answered

Sum quarterly rows into annual results of revenue

How about the following? % Create data table with same structure of yours Date = repelem(datetime(2017,3,1)+3*calmonths(0:3),1...

Sum quarterly rows into annual results of revenue

How about the following? % Create data table with same structure of yours Date = repelem(datetime(2017,3,1)+3*calmonths(0:3),1...

ongeveer 2 maanden ago | 0

Answered

Mahalanobis distance matrix of an excel dataset

Like this? % Read data from Excel file Data = xlsread('yourExcelFile.xlsx'); % Calculate pair-wise mahalanobis distance D ...

Mahalanobis distance matrix of an excel dataset

Like this? % Read data from Excel file Data = xlsread('yourExcelFile.xlsx'); % Calculate pair-wise mahalanobis distance D ...

ongeveer 2 maanden ago | 0

| accepted

Answered

Trouble using sscanf to find numbers in a string?

Thank you for uploading your data file! How about the following? % Read data file fid = fopen('TemperatureRecord.txt','r'); ...

Trouble using sscanf to find numbers in a string?

Thank you for uploading your data file! How about the following? % Read data file fid = fopen('TemperatureRecord.txt','r'); ...

2 maanden ago | 0

Answered

How to find shortest distance in 3D?

You can use shortestpath function to find the shortest path between selected nodes. I believe the solution would be looks like t...

How to find shortest distance in 3D?

You can use shortestpath function to find the shortest path between selected nodes. I believe the solution would be looks like t...

2 maanden ago | 0

| accepted

Answered

How to save images as jpgs from .mat files struct

To save matrix as an image, please use imwrite function. In addition, if you save your data as an image file, I would recommend...

How to save images as jpgs from .mat files struct

To save matrix as an image, please use imwrite function. In addition, if you save your data as an image file, I would recommend...

2 maanden ago | 0

| accepted

Answered

Creating a table with repeating values

If the size of your variable m_female{1,1}(:,1) is 101-by-1, the following should work. Table_m_xt = table(... ones(101,1),r...

Creating a table with repeating values

If the size of your variable m_female{1,1}(:,1) is 101-by-1, the following should work. Table_m_xt = table(... ones(101,1),r...

2 maanden ago | 0

Answered

Load all fields of a struct as input into a function

If your structure Input always has fields Var1 and Var2, a simple solution would be like this. function Var3 = TestFunction(In...

Load all fields of a struct as input into a function

If your structure Input always has fields Var1 and Var2, a simple solution would be like this. function Var3 = TestFunction(In...

2 maanden ago | 0

| accepted

Answered

How to interpolate in 3d?

You can use scatteredInterpolant to do this task. The following is an example. % Read data file Data = xlsread('Mappe2.xlsx') ...

How to interpolate in 3d?

You can use scatteredInterpolant to do this task. The following is an example. % Read data file Data = xlsread('Mappe2.xlsx') ...

2 maanden ago | 1

| accepted

Answered

Interpolate positions between 2 matrix

How about the following? % First point position in the matrix M1 = [0 0 0 1 0 0 0; 0 0 0 0 0 0 0; 0 0 0 0 0 0 0; 0 0 0 0 0...

Interpolate positions between 2 matrix

How about the following? % First point position in the matrix M1 = [0 0 0 1 0 0 0; 0 0 0 0 0 0 0; 0 0 0 0 0 0 0; 0 0 0 0 0...

2 maanden ago | 0

| accepted

Answered

I have matrix F (x,y coordinates), which is 1000*2 matrix. i calculated distances between coordinates using PDIST2 command. i want coordinates which are at distance greater than 22?

One possible solution would be like this: F = [x5;y5]'; % x,y coordinates D = pdist(F); % pdist function is suitable in this c...

I have matrix F (x,y coordinates), which is 1000*2 matrix. i calculated distances between coordinates using PDIST2 command. i want coordinates which are at distance greater than 22?

One possible solution would be like this: F = [x5;y5]'; % x,y coordinates D = pdist(F); % pdist function is suitable in this c...

3 maanden ago | 0

| accepted

Answered

second order data fitting using least squares

Another possible solution: x = [0.81 0.85 0.91 1.00 1.17 1.33 1.36 1.37 1.39 1.40 1.42]'; y = [0.58 0.69 0.81 0.93 1 0.91 0.84...

second order data fitting using least squares

Another possible solution: x = [0.81 0.85 0.91 1.00 1.17 1.33 1.36 1.37 1.39 1.40 1.42]'; y = [0.58 0.69 0.81 0.93 1 0.91 0.84...

3 maanden ago | 0

Answered

How to match Y with X?

How about the following? Running this code, the table T becomes the same as in your desired_output.xlsx. X = readtable('X .xlsx...

How to match Y with X?

How about the following? Running this code, the table T becomes the same as in your desired_output.xlsx. X = readtable('X .xlsx...

3 maanden ago | 1

| accepted

Answered

how to calculate the standard deviation for each month in monthly time series data of 46 years?

If your goal is to calculate the standard deviation for each month, you don't need to reshape the data to 46X12. The following ...

how to calculate the standard deviation for each month in monthly time series data of 46 years?

If your goal is to calculate the standard deviation for each month, you don't need to reshape the data to 46X12. The following ...

3 maanden ago | 0

Answered

how to convert to a cell array from a single precision array

Hi Saugata-san, Thank you for providing more details. I believe the following will do the task you explained. a = [1.1 1.2; ...

how to convert to a cell array from a single precision array

Hi Saugata-san, Thank you for providing more details. I believe the following will do the task you explained. a = [1.1 1.2; ...

3 maanden ago | 0

Answered

Having trouble rotating rectangle shape

Input argument of rotate function shall be a surface, patch, line, text, or image object. How about the following? figure axis...

Having trouble rotating rectangle shape

Input argument of rotate function shall be a surface, patch, line, text, or image object. How about the following? figure axis...

3 maanden ago | 0

Answered

How to find points inside a country border

How abou the following? (In this script, I have used shape file provided in http://thematicmapping.org/downloads/world_borders....

How to find points inside a country border

How abou the following? (In this script, I have used shape file provided in http://thematicmapping.org/downloads/world_borders....

3 maanden ago | 1

| accepted

Answered

intersect two datetime vectors

The following can find identical timestamp with 0.1 sec tolerance. % Load data load('example1.mat'); % Find identical times...

intersect two datetime vectors

The following can find identical timestamp with 0.1 sec tolerance. % Load data load('example1.mat'); % Find identical times...

3 maanden ago | 1

Answered

How can I replace data in a specific address in a text file with new modified data?

Looking at your uploaded data file, I think one possible solution would be like this. % Read all lines in text file fid = fope...

How can I replace data in a specific address in a text file with new modified data?

Looking at your uploaded data file, I think one possible solution would be like this. % Read all lines in text file fid = fope...

3 maanden ago | 0

| accepted

Answered

Show long path with ... in short label like 'D:\folder\subfolder\...\data'

How abou the following? dirName = 'C:\svn-work\projects\projectname\matlab\mytoolname\data'; c = strsplit(dirName,'\'); dir...

Show long path with ... in short label like 'D:\folder\subfolder\...\data'

How abou the following? dirName = 'C:\svn-work\projects\projectname\matlab\mytoolname\data'; c = strsplit(dirName,'\'); dir...

3 maanden ago | 1

| accepted

Answered

Extracting numbers from a filename

How about using regular expression? The following is a simple example. fileName = 'data_23.175_75.125'; num = regexp(fileNa...

Extracting numbers from a filename

How about using regular expression? The following is a simple example. fileName = 'data_23.175_75.125'; num = regexp(fileNa...

3 maanden ago | 0

Answered

Dividing a Matrix into submatrices according to a specific column value

The following is an another way that is easy to understand intuitively: % create a random matrix 10 x 4 A = rand(10,4); % t...

Dividing a Matrix into submatrices according to a specific column value

The following is an another way that is easy to understand intuitively: % create a random matrix 10 x 4 A = rand(10,4); % t...

3 maanden ago | 0

Answered

button to plot waveforms

Like this? function guiSample() h = figure; uicontrol(... 'Parent', h,... 'Units', 'normalized',... 'Position',...

button to plot waveforms

Like this? function guiSample() h = figure; uicontrol(... 'Parent', h,... 'Units', 'normalized',... 'Position',...

3 maanden ago | 0

Answered

Any algorithm to separate very high values from a data set?

If you have percentage of outlier (say, 5%), I think you can assume 95th percentiles of a data set as a threshold, like: % Assu...

Any algorithm to separate very high values from a data set?

If you have percentage of outlier (say, 5%), I think you can assume 95th percentiles of a data set as a threshold, like: % Assu...

3 maanden ago | 0

| accepted

Answered

how can I average monthly Windspeed (Ws) data from 1945-2010. The data loaded into a struct, with 2 fields (data.t and data.ws)

Thank you for sharing your original CSV file. By using readtable and retime functions, you can do this task more easily! Follow...

how can I average monthly Windspeed (Ws) data from 1945-2010. The data loaded into a struct, with 2 fields (data.t and data.ws)

Thank you for sharing your original CSV file. By using readtable and retime functions, you can do this task more easily! Follow...

3 maanden ago | 0

| accepted

Answered

Merge two text files using uiget

One possible solution would be like this. Just FYI: Since menu function is not recommended in recent MATLAB versions, I have ...

Merge two text files using uiget

One possible solution would be like this. Just FYI: Since menu function is not recommended in recent MATLAB versions, I have ...

4 maanden ago | 0

Answered

Compare elements and shift the elements up or down based on matching previous or next elements

If x1 contains all elements in x2 and x3, I believe the following code works. x1 = ... ["Liability and Equity"; "Short-te...

Compare elements and shift the elements up or down based on matching previous or next elements

If x1 contains all elements in x2 and x3, I believe the following code works. x1 = ... ["Liability and Equity"; "Short-te...

4 maanden ago | 0

Answered

Interpolation of angular data spline or linear?

One possible solution would be looks like this. In addition, if you feel @Image Analyst's answer for your previous question usef...

Interpolation of angular data spline or linear?

One possible solution would be looks like this. In addition, if you feel @Image Analyst's answer for your previous question usef...

4 maanden ago | 1

| accepted

Answered

How to extract 3 distinct curves from a mask into separate matrices?

Assuming your 1018x2038 mask is BW, the following code can extract coordinates of each line. s = regionprops(BW,'PixelList'); ...

How to extract 3 distinct curves from a mask into separate matrices?

Assuming your 1018x2038 mask is BW, the following code can extract coordinates of each line. s = regionprops(BW,'PixelList'); ...

4 maanden ago | 1

| accepted