Considering a 3D matrix. How to delete the first column of the first matrix, the second column of the second matrix, the third column of the third matrix and so on.
3 views (last 30 days)
Show older comments
Mariana on 21 Nov 2017
Answered: Image Analyst on 21 Nov 2017
% Considering 3D matrix of dimension n
Image Analyst on 21 Nov 2017
For example, try this:
% Create sample data: cube of size n.
m = randi(9, n, n, n)
% Create output array.
output = zeros(n, n-1, n);
for z = 1 : size(m, 3)
thisPlane = m(:,:,z);
columnToRemove = z;
% Remove column by setting all elements of the column to null.
thisPlane(:, columnToRemove) = ;
% Assign narrower matrix to the zth plane of the output.
output(:,:,z) = thisPlane;
% Print to command window.
More Answers (0)
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!