How could I extract the first two columns, and leave the next two and then so on from a matrix
10 ビュー (過去 30 日間)
古いコメントを表示
for example I have 100 columns, then how could I extract the first two and then leave the next two columns like this (1,2,5,6,9,10,13,14,..............97,98)..
0 件のコメント
採用された回答
Joel Handy
2019 年 8 月 5 日
編集済み: Joel Handy
2019 年 8 月 5 日
% Set up example data set
A = eye(100);
A(1,:) = 1:100;
numCols = size(A,2);
% Answer
B = A(:,sort([1:4:numCols 2:4:numCols]));
% Verification
size(B)
B(1,:)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!