Answered
Array concatenation in for loop
When the size of matrix varies, the option to save the matrix is a cell array. G = cell(10,1) ; for i = 1:1:10 G{i} = F1 ; ...

5 years ago | 0

| accepted

Answered
Display a matrix as an image with boundaries(borders) between different components
Read about this: https://in.mathworks.com/help/images/ref/bwlabel.html and this https://in.mathworks.com/matlabcentral/fileexcha...

5 years ago | 0

Answered
hello everyone. How to divide a group of points named data into two parts, dataA and dataB, as shown in the figure. Thank you very much.
x = data(:,1) ; y = data(:,2) ; mx = mean(x) ; my = mean(y) ; idx = y < my ; x1 = x(idx) ; y1 = y(idx) ; x2 = x(~idx...

5 years ago | 0

Answered
Reshaping and sizing a matrix
You can get the indices of your range and plot them. idx = A(:,1) >= 150 & A(:,1) <= 500 ; % get your range of values % plo...

5 years ago | 0

Answered
How to find specific x values of specific y value of a plotted graph?
y = linspace(0,50000,50001); % y values R=33*10^3; % constant C=10^-8; % cons...

5 years ago | 0

| accepted

Answered
How to plot a 3D graph?
Z matrix is complex number. Try plotting real, imag or abs. surf(X,Y,real(Z)) % real value surf(X,Y,imag(Z)) % imagina...

5 years ago | 0

Answered
how to separate string matrix by zeros
id = zeros([],1) ; % indices of required strings count = 0; for i = 1:size(m,1) t = str2num(m(i,:)) ; if any(...

5 years ago | 0

Answered
Find the index of first and last non zero in column
A = [0 89 90 0 99 100 0] ; id1 = find(A,1,'first') id2 = find(A,1,'last')

5 years ago | 0

Answered
WHY DOES the 2nd Approx does not show
You forgot to use hold on. plot(x(1:end-1), ERROR1, 'g'); hold on plot(x(1:end-2), ERROR2, 'r');

5 years ago | 1

Answered
Filter amplitude vs time data
data=load('data.txt'); t=(0:10:4*3600)'; [val,idx] = max(data) ; ti = (0:0.05:4*3600)' ; datai = interp1(t,data,ti) ;...

5 years ago | 0

Answered
How to add vertical values in three dimensional matrix
Convert your time into datevec. This will give you day, month, year etc. Run loop for each month. Pick the months indices fro...

5 years ago | 1

| accepted

Answered
the way find the specific data select
Read about MATLAB indexing an array. If you want data from 25 to 100, just use: iwant = data(25:100,:) ; If you are looking t...

5 years ago | 0

Answered
How to remove more than K consecutive NaN values from row matrix
x=[2 5 NaN NaN 8 11 5 9 12 NaN NaN NaN NaN NaN NaN 4 2 NaN NaN 16 NaN NaN NaN 1 NaN 6 NaN NaN NaN NaN NaN NaN] ; idx = isnan(x...

5 years ago | 0

| accepted

Answered
Scatter-plot of data in which the cluster membership is coded by colors.
gscatter (alldata(:,1),alldata(:,2),clust,'rbgk','xod') Check the option E.OptimalY, it is empty []. So all the points are show...

5 years ago | 0

Answered
Calling function error in MAtlab
I guess you have not downloaded/ copied the function PlaneTrussElementStiffness in your working folder. It is not an inbuilt fun...

5 years ago | 0

Answered
How can I plot this exact 3d contour plot
Refer this link: https://in.mathworks.com/matlabcentral/answers/412639-creating-surface-plot-from-a-matrix-with-3-columns

5 years ago | 0

Answered
How to plot 2d filled contour
x = linspace(0,1) ; m = linspace(0,1) ; [X,M] = meshgrid(x,m) ; Y = (0.32./(0.32+0.38*X)).^2 ; dX = gradient(X) ; ...

5 years ago | 1

| accepted

Answered
How can I calculate the intersection points of 9th order polynomial and straight line??also how to find out the specific data from excel and plot that
For intersection points, you can use this file exchange: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-interse...

5 years ago | 0

Answered
how to plot 3D data using NetCDF files ?
Reading ncfile is very easy in MATLAB. You need to know only very few functions. Read about ncdisp, ncread. ncfile = 'san_dieg...

5 years ago | 0

Answered
how can i write code for animating the plots when i use column vector.
Let (t1,x1) and (t2,x2) be your data. Where x1 is surge and x2 is tension. Both t1, t2 are in same intervel. First let's get t...

5 years ago | 0

Answered
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-3.
The error is simple, you are trying to save more number of elements into a matrix then it is initialized. Example: A = zeros(...

5 years ago | 1

Answered
Patch won't fill my polygon and inpolygon won't find points inside
load('coords') % Remove nans hhx(isnan(hhx)) = [] ; hhz(isnan(hhz)) = [] ; % GEt the boundary idx = boundary(hhx,hhz) ; ...

5 years ago | 0

Answered
How do I plot values on top of bar?
x = [20 40 60 80 100]'; y = [0.0036 0.0149;0.0033 0.0149;0.0023 0.0192;0.0021 0.0235;0.0018 0.0279]; bar(x,y) text(x, y(:,1...

5 years ago | 0

| accepted

Answered
Extract two frist numbers form a column
A = [68.092 67.011 76.949] ; integ = floor(A); fract = A-integ;

5 years ago | 0

Answered
Select specific values of a column in a matrix
Are you looking for something like this? [C, ia, ic] = unique(data(:,3)) ; N = length(C) ; iwant = cell(N,1) ; for i = 1...

5 years ago | 1

Answered
I am not sure why my if statement code is not working
x is an array and you are comapring it with a scalar. x=SULPHUR(:,2); x(isnan(x)) = []; for i=1:length(x) if x(i) > 0.5...

5 years ago | 0

| accepted

Answered
Detect NaN from table
A = [1 2 NaN 5 NaN] ; idx = isnan(A) ; A(idx)

5 years ago | 0

Answered
Contour map of ocean current on transect
You have vectors in hand....you can have quiver plot using: quiver(ucur,vcur) If you have lon and lat values use: quiver(lon...

5 years ago | 1

| accepted

Answered
How to use GPU with your matlab program?
To run your code in GPU, you need not to do much. It is very easy and straight forward. You need to place the variable/ data int...

5 years ago | 0

| accepted

Load more