reshape vector to matrix
1 回表示 (過去 30 日間)
古いコメントを表示
I want to convert
d = [1 2 3 4 5]
to d = [1 2
2 3
3 4
4 5]
is there anyway I can do it.
0 件のコメント
採用された回答
Stephen23
2020 年 10 月 25 日
A general solution for an arbitrary number of rows and columns:
>> d = [1,2,3,4,5];
>> r = 4;
>> m = hankel(d(1:4),d(r:end))
m =
1 2
2 3
3 4
4 5
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!