Answered

How to remove or identify spikes in a random signal.

Looking at your data, negative spikes you mentioned is always less than 1000. So, if this condition is applicable to other data,...

How to remove or identify spikes in a random signal.

Looking at your data, negative spikes you mentioned is always less than 1000. So, if this condition is applicable to other data,...

26 dagen ago | 0

| accepted

Answered

How to put the values into the specific area and put color

You don't need to use for-loop. The following is one possible solution. A = zeros(70); % Sample 168-by-1 random array with 1...

How to put the values into the specific area and put color

You don't need to use for-loop. The following is one possible solution. A = zeros(70); % Sample 168-by-1 random array with 1...

28 dagen ago | 0

| accepted

Answered

How to avoid the repetition of events ?

How about using unique function? p = [6 4 2 3 1 17 17 21 21 27]; p = unique(p,'stable'); The output becomes like this: >> p ...

How to avoid the repetition of events ?

How about using unique function? p = [6 4 2 3 1 17 17 21 21 27]; p = unique(p,'stable'); The output becomes like this: >> p ...

28 dagen ago | 0

Answered

How to specify line color using a hexadecimal color code

It would be due to your MATLAB version. Hexadecimal color code can be used in the latest version (R2019a). If your version is R...

How to specify line color using a hexadecimal color code

It would be due to your MATLAB version. Hexadecimal color code can be used in the latest version (R2019a). If your version is R...

29 dagen ago | 0

| accepted

Answered

Extract rows in one array based on time values in a another array +20 seconds

Simple and straight-forward way would be like this. Just in case, I have saved your truncated example of array A and B as .mat ...

Extract rows in one array based on time values in a another array +20 seconds

Simple and straight-forward way would be like this. Just in case, I have saved your truncated example of array A and B as .mat ...

29 dagen ago | 0

| accepted

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

ongeveer een maand 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); ...

ongeveer een maand 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...

ongeveer een maand 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...

ongeveer een maand 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-...

ongeveer een maand 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...

ongeveer een maand 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...

ongeveer een maand 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. ...

ongeveer een maand 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...

ongeveer 2 maanden 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...

ongeveer 2 maanden 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...

ongeveer 2 maanden 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...

ongeveer 2 maanden 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...

ongeveer 2 maanden 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');...

ongeveer 2 maanden 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 ...

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

ongeveer 2 maanden 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)...

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

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

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

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

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

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

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

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

2 maanden ago | 0

| accepted