|
On 10-12-03 02:44 PM, Saurabh wrote:
> I have 3 dimensional matrix points(:,:,:) . I want to delete a row from
> the 2 dimensional matrix which is represented by first two dimensions.
> For example if I have a 10x20x30 matrix, then how to delete a row
> referenced by points(2,:,3) , i.e. the second row of the 2-d matrix
> which belongs has the third dimension as 3.
In a 3D matrix, if you want the result to remain a 3D matrix instead of
collapsing to a column vector, you would have to delete an entire plane rather
than just one row.
points(2,:,3) = [];
would have the problem that points([1 3:10],:,:) would then be a different
size than points(2,:,3), and that would not be allowed.
The 2D equivalent of your question would be to delete a single element from a
2D matrix without affecting any of the other rows or columns of the matrix...
can't be done.
You could overwrite the section with NaN; depending on the calculations you
are doing, that works even better than actual erasing.-
|