help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Difference of columns


From: Ismael Núñez-Riboni
Subject: Re: Difference of columns
Date: Thu, 29 Aug 2013 15:06:44 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

> I would like a code giving me a matrix B having three
> columns:C_1-C_2,C_1_C_3 and C_2-C_3
> regards

My code does that, i.e., making all combinations of columns (including a column with itself) and subtracting one from the other. If you don't want the combination of a column with itself you can modify the code like this:

cc = 1;

for i = 1:N
   for j = 1:N
      if i ~= j
         diff(:,cc) = A(:,i) - A(:,j);

         cc = cc +1;
      end
   end
end

Cheers, I.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]