How to convert multi sized cell array into an MxN matrix

3 ビュー (過去 30 日間)
Sreekanth Nandakumar
Sreekanth Nandakumar 2019 年 3 月 22 日
編集済み: Jan 2019 年 3 月 25 日
I have a cell array of 1x257 in which each cell array column contains different sized Mx1 array as shown in the screenshot. Cell_array.jpg
As you can see, each column in this cell array has different number or rows in it. I need to convert this cell array named Voltage into a matrix with each column contains all the numerical data that is present in the correspoding cell array column.
That means, the first cell array has 143 rows. So the column 1 of my new matrix has 143 rows. Similarly column 2 contains 44 rows etc. upto 257 columns. Is it even possible to form a table of different rows ?
Advance gratitude for any help.

採用された回答

Jan
Jan 2019 年 3 月 22 日
編集済み: Jan 2019 年 3 月 25 日
Matrices have te same number of elements in all columns and rows, repsectively. This is the definition of a matrix. So you cannot store vectors of different lengths in a matrix.
You can pad the vectors with NaNs, if this is sufficient for your problem. But storing a collection of vectors of different size in a cell array seems to be clear, clean and efficient.
  1 件のコメント
Sreekanth Nandakumar
Sreekanth Nandakumar 2019 年 3 月 22 日
Thankyou very much for your answer. I wanted to store all the data into a table so that it can be read easily. Converting into a 'matrix' was a wrong choice of word. Thank you very much once again. :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by