Answered
How to call the row number of an element?
With find, but be mindful that direct logical indexing is often faster if you are seeking to modify the matrix. Compare: %Repla...

4 years ago | 0

Answered
AUC or trapz for irregular shape that intersects itself
Perhaps as follows? p=polyshape(WL_1546La, WL_1546Fa); Areas=area(regions(p))

4 years ago | 0

Answered
Is it possible to loop through and set image pixels with a parfor loop?
If you have the Image Processing Toolbox, you should use imwarp to perform an image transformation.

4 years ago | 1

Answered
Why does filtering data before PCA improve results?
PCA applied to the transformed cluster should find PC1 close to L', and therefore the projections of the images on L' should be ...

4 years ago | 0

Answered
how can I find the max value out of iterative for loop ?
Seems to be working: count=1; while 1 for i=1:20 x(i)= randi(87);% calculations end maxvalue(cou...

4 years ago | 0

| accepted

Answered
Store m iterations of a variable in for loop
Perhaps as follows: ivals=1:step:m; J=numel(ivals); [LAT_3,LON_3,ALT_3]=deal(nan(1,J)); for j = 1:J i=ivals...

4 years ago | 0

| accepted

Answered
How to generate a smooth derivative after fitting a curve to the data?
You can try some different choices of the smoothing parameter, load Data % using cubic spline pp = spline(x,y); derX= fnde...

4 years ago | 0

Answered
Using structures with Functions
@Stephen23's answer might be what you are looking for, but if you need the struct in scalar form for some reason, then the attac...

4 years ago | 1

Answered
How do I combine 3 figures into a single plot and compare them?
Perhaps this is what you mean. Start with 3 plots, colors={'r','g','m'} for i=1:3 figure(i); h(i)=plot((0:4)+i,colors{i}); y...

4 years ago | 0

Answered
How to remove thin lines from the following image?
Perhaps bwpropfilt(bW,'Eccentricity',____)

4 years ago | 0

Answered
Using bwpropfilt after imrotate
The reason, I suspect, that the number of objects seems to decrease when you imrotate is that you have several objects that are ...

4 years ago | 0

| accepted

Answered
how can I solve this problem
Are N and W known variables? Your code does not provide them, but if they are known, you can reorganize as a polynomial and use ...

4 years ago | 1

Answered
How to generate and store in different sizes vectors or cells in a loop?
Use cell arrays. interval=cell(1,length(Vneg)); for con=1:length(Vneg); interval{con}=A(A(:,1)>=Fneg(con2) & A(:,1...

4 years ago | 0

| accepted

Answered
Using Curve Fitter, computing Local Maximum (y) and corresponding (x) and export x y of fitted curve to external format (Excel)
If all you're after is the local max, I would skip the curve fitting app and use polyfit. keep=~(isnan(x)|isnan(y)); x=x(keep)...

4 years ago | 0

| accepted

Answered
Exponential curve fitting with nonlinearleastsquares methood
Use fminspleas from the File Exchange, which only requires an initial guess of T1. https://www.mathworks.com/matlabcentral/file...

4 years ago | 0

Answered
How can I delete a row based on the value of the previous row?
It'll have to be done with a loop, A=[10, 11.5, 13.3 13.5 13.7 17]; i=2; while i<=numel(A) if A(i)<A(i-1)+2 ...

4 years ago | 0

Answered
How can I delete a row based on the value of the previous row?
rowstodelete = diff([inf;A])<2;

4 years ago | 0

Answered
how to convert 4D into 3D?
If you mean you want the i-th 3D frame of the 4D data, then, frame_i=cropVol(:,:,i)

4 years ago | 0

Answered
Retrieve cartesian coordinates from a 3D shape surface
Call ellipsoid with outputs, [X,Y,Z] = ellipsoid(xc,yc,zc,xr,yr,zr)

4 years ago | 1

| accepted

Answered
Calculating the value, excluding nan
subset=1993<=y & y<=2021; datasub=data_crsp(subset,7); ysub=y(subset)-1992; stockreturn=splitapply(@(z)mean(z,'omitnan'),...

4 years ago | 0

Answered
Finding the value according to row number
data_crsp(dr(:,1),2)

4 years ago | 0

| accepted

Answered
How do I set coefficient variables in Fittype that was generated in Fitting toolbox?
Instead of a fitType object, use an anonymous function like in this example, https://www.mathworks.com/help/curvefit/fit.html#b...

4 years ago | 0

| accepted

Answered
how to compare two consecutive values in a matrix
M=(diff(temp2,1,2)<=0);

4 years ago | 0

Answered
How to detect corners of irregular binary shape?
You might try pgonCorners from the File Exchange: https://www.mathworks.com/matlabcentral/fileexchange/74181-find-vertices-in-i...

4 years ago | 0

| accepted

Answered
How to automate the matrix-vector multiplication using the index of a vector?
m = 50; a = 5; b = 2; c = 2; J = [diag(a*ones(1,m)) + diag(b*ones(1,m-1),1) + diag(c*ones(1,m-1),-1)]; syms y [m,1] ex...

4 years ago | 0

Answered
How to get a matrix which acquires a pixel values along a spiral trajectory of Image.
sz=size(Image); J=sub2ind(sz,x,y); I=(1:numel(x))'; C=sparse(I,J,1);

4 years ago | 0

| accepted

Answered
operation on single elements in MATLAB
x=-2:1:2; %coordinates x n=length(x); y=x.^2; %coordinates y z=[x;y] interDistances=vecnorm(diff(z,1,2),2,1) %the result...

4 years ago | 1

| accepted

Answered
Finding the max number of non-zero repeating elements for each row in a large matrix
This should be fine for the uint8 case. For the uint16 case, it might strain RAM. A = [0 0 2 2 3; 0 1 3 3 3; 0 0 0 ...

4 years ago | 1

Answered
Finding the max number of non-zero repeating elements for each row in a large matrix
size(A,2) is relatively small, That being the case, I'd just use a loop: A = [0 0 2 2 3; 0 1 3 3 3; 0 0 0 0 0; ...

4 years ago | 2

| accepted

Answered
Two easy questions (But I am confused)
No need for (explicit) loops: S=rand(100); Sdiag=diag(S); cellstr("Row "+(1:100))

4 years ago | 1

| accepted

Load more