How can I make this matrix ?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Voss
2022-12-13
% your matrix:
i = 0; m = 1; j = 2; n = 3;
M = repmat([i i i m m j j j n n],4,1)
% delete columns 4-5 and 9-10:
M(:,[4 5 9 10]) = []
4 个评论
Voss
2022-12-14
Suppose you want to delete columns 4, 9, 14, ... and columns 5, 10, 15, ...
M = reshape(1:100,4,[])
spacing = 5;
N_Cols = size(M,2);
col_to_delete = [4:spacing:N_Cols 5:spacing:N_Cols];
M(:,col_to_delete) = []
No loop necessary.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!