Split 2 lines of a matrix?
1 回表示 (過去 30 日間)
古いコメントを表示
採用された回答
dpb
2019 年 6 月 1 日
B=[A(3:4,:);A]; % create new array keeping old
A=[A(3:4,:);A]; % new array replaces/augments old
More generically,
N=2; % number rows at end to add to beginning
A=[A(end-N+1:end,:);A]; % add N last lines at beginning
2 件のコメント
dpb
2019 年 6 月 6 日
Just a simple substitution of variables from the explicit case--with the generic ML function end for the last row and the expression for the row number from the end to pick up N rows.
For your specific case that picked up two rows and has size(A,1)==>4, plug in the values and see what you get...
その他の回答 (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!