I have a cell array of size 544 1 , how can I convert it to a matrix of dimension 151*101 without nan appear in the matrix?

1 件のコメント

John D'Errico
John D'Errico 2014 年 12 月 10 日
Um, magic?
You give us no hint at all what is in those cells. So how can we possibly know how to convert it into an array of totally different size and shape?

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

 採用された回答

Star Strider
Star Strider 2014 年 12 月 10 日

0 投票

I doubt if you can.
A matrix of size (151x101) has 15251 elements. Your vector has 544 elements. You have to fill the extra 14707 elements with something, and NaN is probably the best option.

4 件のコメント

Fatin
Fatin 2014 年 12 月 10 日
編集済み: Fatin 2014 年 12 月 10 日
There is a mistake in my question, the size of array m is 540*1 , and I want it 151*101 Can I use reshape(m,36,15) then use interpolation to get the 151*101 matrix?
Star Strider
Star Strider 2014 年 12 月 10 日
Interpolation is certainly an acceptable solution. I don’t know what your data are or the reason you want to reshape your array, but you could also do the interpolation first, to expand your vector out to 15251 elements, and reshape it after that. That would be my approach, since it’s easier.
Fatin
Fatin 2014 年 12 月 10 日
Thank you , I will try that.
Star Strider
Star Strider 2014 年 12 月 10 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

質問済み:

2014 年 12 月 10 日

コメント済み:

2014 年 12 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by