From: Giga Babs on 22 Apr 2010 05:17 Hya Is there a matlab function for changing the position of 2 rows in a matrix ??, for example I have A= [1,8,6 ; 7,8,9 ; 6,4,5 ; 1,2,3] And I want to have B= [1,8,6 ; 1,2,3 ; 6,4,5 ; 7,8,9] I permute the row 2 and 4 from the matrix A.... Thank you in advance
From: Walter Roberson on 22 Apr 2010 05:42 Giga Babs wrote: > Hya Is there a matlab function for changing the position of 2 rows in a > matrix ??, > for example I have A= [1,8,6 ; 7,8,9 ; 6,4,5 ; 1,2,3] > > And I want to have B= [1,8,6 ; 1,2,3 ; 6,4,5 ; 7,8,9] I permute the row > 2 and 4 from the matrix A.... B = A([1 4 3 2], :); or: B = A; B([2 4],:) = A([4 2],:);
From: Giga Babs on 22 Apr 2010 09:19 Walter Roberson <roberson(a)hushmail.com> wrote in message <hqp5m1$735$2(a)canopus.cc.umanitoba.ca>... > Giga Babs wrote: > > Hya Is there a matlab function for changing the position of 2 rows in a > > matrix ??, > > for example I have A= [1,8,6 ; 7,8,9 ; 6,4,5 ; 1,2,3] > > > > And I want to have B= [1,8,6 ; 1,2,3 ; 6,4,5 ; 7,8,9] I permute the row > > 2 and 4 from the matrix A.... > > B = A([1 4 3 2], :); > > or: > > B = A; > B([2 4],:) = A([4 2],:); Thank you Walter
|
Pages: 1 Prev: Need some help with the Data Acquisition Toolbox Next: read/write Exsel file under Mac OS |