Answered

HOW TO CONVERT A PNG IMAGE IN TO A EPS IMAGE?

Like this? % Read png file I = imread('peppers.png'); % Show the image figure imshow(I,'Border','tight') % Save as eps...

HOW TO CONVERT A PNG IMAGE IN TO A EPS IMAGE?

Like this? % Read png file I = imread('peppers.png'); % Show the image figure imshow(I,'Border','tight') % Save as eps...

2 days ago | 0

Answered

How to mask out the object in the image?

How about the following? % Read and binarize your image I = imread('ms.jpg'); Igray = rgb2gray(I); BW = imbinarize(Igray); ...

How to mask out the object in the image?

How about the following? % Read and binarize your image I = imread('ms.jpg'); Igray = rgb2gray(I); BW = imbinarize(Igray); ...

2 days ago | 0

Answered

Find at least 5 consecutive values above a certain threshold in a vector?

If there are 2 or more consective values above the threshold, the following is one possible solution. (* The following needs Im...

Find at least 5 consecutive values above a certain threshold in a vector?

If there are 2 or more consective values above the threshold, the following is one possible solution. (* The following needs Im...

4 days ago | 1

Answered

How to make a rainbow in MatLab?

One possible way: t = linspace(0,pi)'; x = cos(t); y = sin(t); color = jet(7); figure hold on for kk = 1:7 plot((2+k...

How to make a rainbow in MatLab?

One possible way: t = linspace(0,pi)'; x = cos(t); y = sin(t); color = jet(7); figure hold on for kk = 1:7 plot((2+k...

5 days ago | 0

| accepted

Answered

noise removal from image

If the noise is exactly horizontal, one straight-forward solution would be like this: % Read your image and convert it to gray-...

noise removal from image

If the noise is exactly horizontal, one straight-forward solution would be like this: % Read your image and convert it to gray-...

5 days ago | 0

| accepted

Answered

How to find the last nonzero entry in all rows of a sparse matrix?

How about the following? [Solution 1] A = [1 3 0 0 0 0;0 4 2 3 0 0;5 0 0 1 4 0]; pos = nan(size(A,1),1); for kk = 1:size(A...

How to find the last nonzero entry in all rows of a sparse matrix?

How about the following? [Solution 1] A = [1 3 0 0 0 0;0 4 2 3 0 0;5 0 0 1 4 0]; pos = nan(size(A,1),1); for kk = 1:size(A...

13 days ago | 0

| accepted

Answered

making an array to skip missing data for mean calculations

If you want to calculate mean value for each column with ignoring -999 value, how about the following solution? % Assuming your...

making an array to skip missing data for mean calculations

If you want to calculate mean value for each column with ignoring -999 value, how about the following solution? % Assuming your...

13 days ago | 0

Answered

How to group a matrix based on height

If you have Image Processing Toolbox, you can do this task easier by using bwlabel function. The following is a simple example. ...

How to group a matrix based on height

If you have Image Processing Toolbox, you can do this task easier by using bwlabel function. The following is a simple example. ...

13 days ago | 0

Answered

Spline interpolation is giving me errors with array index

At least the latest version R2019a, your code works well. Anyway, I would recommend adjusting vector direction of t and xx, lik...

Spline interpolation is giving me errors with array index

At least the latest version R2019a, your code works well. Anyway, I would recommend adjusting vector direction of t and xx, lik...

18 days ago | 0

Answered

how to Interpolate hourly data

Hmm, interesting problem. I think the following is one possible straight-forward solution. % Read data file D = dlmread('test...

how to Interpolate hourly data

Hmm, interesting problem. I think the following is one possible straight-forward solution. % Read data file D = dlmread('test...

20 days ago | 1

Answered

split a rectangular matrix

How about the following? input = [1 0 0 0; 0 1 0 0; 0 0 1 0]; output = zeros([size(input),size(input,1)]); for kk = 1:siz...

split a rectangular matrix

How about the following? input = [1 0 0 0; 0 1 0 0; 0 0 1 0]; output = zeros([size(input),size(input,1)]); for kk = 1:siz...

20 days ago | 1

| accepted

Answered

how do I plot this vector graphs?

The vector plot for the problem 1-(a) will be like this. Now, I would recommend trying to do the same thing for the remaining pr...

how do I plot this vector graphs?

The vector plot for the problem 1-(a) will be like this. Now, I would recommend trying to do the same thing for the remaining pr...

20 days ago | 0

Answered

3D Matrix (n*m*p) in Table

How about the following? % Sample data (n,m,p were assumed to be 20,10,5,respectively) A = rand(20,10,5); % Save as an Exce...

3D Matrix (n*m*p) in Table

How about the following? % Sample data (n,m,p were assumed to be 20,10,5,respectively) A = rand(20,10,5); % Save as an Exce...

20 days ago | 0

| accepted

Answered

How to skip first three lines in Matlab and read the next line until fixed character appears?

Another possible solution: % Read the file as a text fid = fopen('Example.txt','r'); C = textscan(fid,'%s','Delimiter','\n');...

How to skip first three lines in Matlab and read the next line until fixed character appears?

Another possible solution: % Read the file as a text fid = fopen('Example.txt','r'); C = textscan(fid,'%s','Delimiter','\n');...

23 days ago | 0

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

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

25 days ago | 0

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

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

1 month 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))...

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

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

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

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

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

1 month 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 = ...

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

1 month 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 =...

1 month 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

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

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

2 months ago | 1

| accepted