Subtraction matrix for all values

column 1 - column 2; column 1 - column 3; column 1 - column 4...(rest of subtractions)..olumn 4 - column 4.
How would I approach this?

Answers (1)

for m=1:size(A,2)
for n=1:size(A,2)
B(:,(m-1)*size(A,2)+n)=A(:,m)-A(:,n);
end
end

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 25 Nov 2020

Edited:

N/A
on 4 Dec 2020

Community Treasure Hunt

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

Start Hunting!