How to convert a matrix into a vector that has each row as an array?
조회 수: 3 (최근 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!