How to convert a matrix into a vector that has each row as an array?

2 views (last 30 days)
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!

Answers (2)

David Hill
David Hill on 7 Feb 2021
I assuming you want a cell array

randerss simil
randerss simil on 7 Feb 2021
C = {{[a b c d]} {[ e f g h]} {[ i j k l]}}


Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!