# I want column matrix in for loop

4 views (last 30 days)
HEMRAJ PATEL on 30 Nov 2021
Commented: HEMRAJ PATEL on 1 Dec 2021
I want to create a matrix where the R (subtracted) matrix is stored in C matrix such that all 9 R(i,j) elements produced from 10 images get stored in first column of matrix c, then next R(i,j) be stored in 2nd column of matrix c and so on.
Here x is row no.
and y is column no.
use whatever image you like with 400X400 pixels
n=10
for x=11:1:13
for y=11:1:13
for i=1:1:9
for k =1:1:(n-1)
I1=image1(1:400,1:400);
I2=image2(1:400,1:400);
R= imsubtract(I2,I1);
c(k,i)=R(x,y);
end
end
end
end

DGM on 30 Nov 2021
Edited: DGM on 30 Nov 2021
I'm not sure, but this might be close to what you want.
n=10
xrange = 11:13;
yrange = 11:13;
for k = 1:(n-1)
I1 = double(image1(xrange,yrange));
I2 = double(image2(xrange,yrange));
c(k,:) = I2(:)-I1(:);
end
HEMRAJ PATEL on 1 Dec 2021
I got it. Thanks

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by