Answered
how do I run a .exe within a .m file?
You can use system function to run a .exe. For example, if you save the following line in .m file and run in MATLAB on Windows P...

6 years ago | 0

| accepted

Answered
How to add labels to an array or table (after conversion from an array)
This is because some characters (such as '/' ) and white space ' ' are not allowed to use as variable names in table. Also, each...

6 years ago | 1

| accepted

Answered
How to print 1x50 array into a text file
How about the following? dlmwrite('output.txt',reshape(A(1:48),8,6)','delimiter','\t'); dlmwrite('output.txt',A(49:50),'-appen...

6 years ago | 1

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

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

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

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

7 years ago | 16

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

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

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

7 years ago | 1

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

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

7 years ago | 1

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

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

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

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

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

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

7 years ago | 1

| accepted

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

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

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

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

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

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

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

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

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

7 years ago | 1

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

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

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

7 years ago | 0

Load more