MATLAB: Hi the matrix=12×5, i need to subtract all these and finally get 12×1 i.e 12×1-12×2, result of (12×1-12×2)-12×3,then result of ((12×1-12x​2)-12×3)-1​2×4…….​……….​.so on

digital image processing

plz help me with matlab code

Best Answer

you said that your matrix is 5 cols so (your matrix variable is mat
out=mat(:,1);
for i=2:5
out=out-mat(:,i);
end
This worked for me alot