How to convert a matrix into a vector that has each row as an array?
2 ビュー (過去 30 日間)
古いコメントを表示
For example, say that I have this matrix: [a b c d; e f g h; i j k l]
To use in python (and to save as .npy), I need the following:
I want the vector to come out like this: [ array([ a, b,c, d]) array([ e, f, g, h]) array([i, j ,k, l]) ]
Thank you!
0 件のコメント
回答 (2 件)
David Hill
2021 年 2 月 7 日
I assuming you want a cell array
a=yourMatrix;
newCellarray=mat2cell(a,ones(1,size(a,1)),size(a,2));
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!