Answered

How to go row by row placing odd rows to Y values and even rows to X values

How about the following? % Create sample data (vector) data = rand(1000,1); % Extract odd and even rows, and save as x and ...

How to go row by row placing odd rows to Y values and even rows to X values

How about the following? % Create sample data (vector) data = rand(1000,1); % Extract odd and even rows, and save as x and ...

3 maanden ago | 0

Answered

select data from table according to date and time

How about the following way? % Create sample data Time = sort(datetime(2019,3,24) + days(7)*rand(1000,1)); Data = rand(1000,1...

select data from table according to date and time

How about the following way? % Create sample data Time = sort(datetime(2019,3,24) + days(7)*rand(1000,1)); Data = rand(1000,1...

3 maanden ago | 1

Answered

how to download data from website?

How about the following? url = 'https://oceandata.sci.gsfc.nasa.gov/MODIS-Aqua/Mapped/Daily/4km/sst/2019/'; str = webread(url)...

how to download data from website?

How about the following? url = 'https://oceandata.sci.gsfc.nasa.gov/MODIS-Aqua/Mapped/Daily/4km/sst/2019/'; str = webread(url)...

3 maanden ago | 0

| accepted

Answered

How to plot matrix inside for loop ?

Like this? A = [0 3/10;3/5 0]; u = [0.3 ;0.8]; p = nan(2,51); % Inisital condition p(:,1) = [0;0]; for n=1:50 p(:,n...

How to plot matrix inside for loop ?

Like this? A = [0 3/10;3/5 0]; u = [0.3 ;0.8]; p = nan(2,51); % Inisital condition p(:,1) = [0;0]; for n=1:50 p(:,n...

3 maanden ago | 0

| accepted

Answered

How can i fill the common areas of two curves?

Another possible solution: y1 = @(x) 3*x.^2 + 2*x +1; y2 = @(x) -5*x.^2 + x + 20; x = -5:0.1:5; pgon1 = polyshape(x,y1(x))...

How can i fill the common areas of two curves?

Another possible solution: y1 = @(x) 3*x.^2 + 2*x +1; y2 = @(x) -5*x.^2 + x + 20; x = -5:0.1:5; pgon1 = polyshape(x,y1(x))...

3 maanden ago | 0

| accepted

Answered

How to label all the edges in a graph the euclidean distance between two adjacent nodes???

I think one possible solution would be like this: % Make Graph object rng('default'); s = [1 1 3]; t = [2 3 4]; G = graph(s...

How to label all the edges in a graph the euclidean distance between two adjacent nodes???

I think one possible solution would be like this: % Make Graph object rng('default'); s = [1 1 3]; t = [2 3 4]; G = graph(s...

3 maanden ago | 0

| accepted

Answered

Vector to Circle in Matrix

If you have Image Processing Toolbox, one solution would be like this: A = zeros(50); A(25,25) = 1; D = bwdist(A); idx = D <...

Vector to Circle in Matrix

If you have Image Processing Toolbox, one solution would be like this: A = zeros(50); A(25,25) = 1; D = bwdist(A); idx = D <...

3 maanden ago | 0

| accepted

Answered

how to reject whole columns based on a condition

No need to use for-loop. Please try the following: A = [5 10 18 13; -2 8 -9 10; 40 47 85 -...

how to reject whole columns based on a condition

No need to use for-loop. Please try the following: A = [5 10 18 13; -2 8 -9 10; 40 47 85 -...

3 maanden ago | 0

Answered

how can I read in this file of varying data types

Another possible solution: fid = fopen('earthquake_data.txt','r'); s = textscan(fid,'%s','Delimiter','\n'); s = s{1}; fclose...

how can I read in this file of varying data types

Another possible solution: fid = fopen('earthquake_data.txt','r'); s = textscan(fid,'%s','Delimiter','\n'); s = s{1}; fclose...

3 maanden ago | 0

Answered

Scatter plot with extra features

How about using quiver function? Here is an example. data = [ % Temp Pres Azim 41 78 45 66 44 0 170 ...

Scatter plot with extra features

How about using quiver function? Here is an example. data = [ % Temp Pres Azim 41 78 45 66 44 0 170 ...

3 maanden ago | 0

Answered

regexprep() skip first occurrence

How about using regexp to find the position of spaces, and delete 2nd~Nth spaces? Like: mystring = 'this is my string'; pos = ...

regexprep() skip first occurrence

How about using regexp to find the position of spaces, and delete 2nd~Nth spaces? Like: mystring = 'this is my string'; pos = ...

3 maanden ago | 0

| accepted

Answered

How to read only numerical data from irregular .csv file

Since your csv file was saved as a 16-bit text, it's a little bit difficult to use textscan to read data correctly. I think ano...

How to read only numerical data from irregular .csv file

Since your csv file was saved as a 16-bit text, it's a little bit difficult to use textscan to read data correctly. I think ano...

3 maanden ago | 0

Answered

Help with making a function.

Like this? (Please save the following code as squareRootCheck.m) function y = squareRootCheck(x) if mod(sqrt(x),1) == 0 y =...

Help with making a function.

Like this? (Please save the following code as squareRootCheck.m) function y = squareRootCheck(x) if mod(sqrt(x),1) == 0 y =...

3 maanden ago | 0

Answered

symmetric color map using surf

Like this? cmap = interp1([-1;0;1],[1 0 0;0 1 0;1 0 0],linspace(-1,1)'); surf(peaks) colormap(cmap) colorbar

symmetric color map using surf

Like this? cmap = interp1([-1;0;1],[1 0 0;0 1 0;1 0 0],linspace(-1,1)'); surf(peaks) colormap(cmap) colorbar

3 maanden ago | 1

| accepted

Answered

Creating a matrix from a lagrer matrix

How about the following? In this case, C{1}, C{2}, ..., C{151} are 200-by-1 matrices each, extracted from original 30194-by-1 m...

Creating a matrix from a lagrer matrix

How about the following? In this case, C{1}, C{2}, ..., C{151} are 200-by-1 matrices each, extracted from original 30194-by-1 m...

4 maanden ago | 1

| accepted

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...

4 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...

4 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...

4 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 ...

4 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'); ...

4 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...

4 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...

4 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...

4 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...

4 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') ...

4 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...

4 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...

5 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...

5 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...

5 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 ...

5 maanden ago | 0