- get a logical row vector of which columns are 1 and which are 0, using either yourmatrix(end, :) == 1 or logical(yourmatrix(end, :)),
- then use that logical vector of 0 and 1 to filter the column with yourmatrix(:, logicalvector)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
1 Comment
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/358736-how-to-select-specific-columns-in-a-matrix-and-create-a-new-one#comment_488281
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/358736-how-to-select-specific-columns-in-a-matrix-and-create-a-new-one#comment_488281
Sign in to comment.