I want to create a matrix where each column is obtained by subtracting 1 from the previous column.
2 ビュー (過去 30 日間)
古いコメントを表示
For example: A=[4 3 2 1 0; 3 2 1 0 -1; 1 0 -1 -2 -3]
0 件のコメント
採用された回答
Guillaume
2016 年 5 月 10 日
Use a loop, repmat or bsxfun. e.g:
startcolumn = [4; 3; 1];
numcolumns = 5;
A = bsxfun(@minus, startcolumn, 0:numcolumns-1)
0 件のコメント
その他の回答 (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!