From: Sadik on 3 Apr 2010 12:04 Hi Eamonn, a(2,:) = []; Best.
From: dpb on 3 Apr 2010 12:13 Eamonn B wrote: > I have a vector set up like this > a = [[5 2 1 4 8]' [6 3 10 3 -5]']; % [x] [y] > > I want to delete the x and y at the same time > > I am able to show the two indices by doing this > [a(2,1) a(2,2)] > > I try and delete them by doing this [a(2,1) a(2,2)]=[] > I get this error > 'Too many output arguments.' > > I have also tried this way > z=[a(2,1) a(2,2)] > a(z)=[] > it works a=1 5 8 10 3 3 6 -5 > but it removes the columns thus putting the x and y together which is > not what I want. > > Anyone know how I can remove the value but still keeping the columns? The problem in general is that if you try to remove more-or-less-randomly placed elements in an array, the array is no longer square--hence the result above of a vector returned. You could set elements to zero but to make them null either would require a cell array or regularizing the elements to be eliminated. --
|
Pages: 1 Prev: Removing indices from a vector Next: to find major and minor axis length |