How do I convert a multidimensional array into a 1 x1 cell array?

I have a 1 x 20 vector and need to convert it into a 1x1 cell array without using 'reshape.'

回答 (2 件)

KSSV
KSSV 2017 年 6 月 19 日

0 投票

A = rand(1,20) ;
iwant{1} = mat2cell(A,1) ;

4 件のコメント

Richard Wilson
Richard Wilson 2017 年 6 月 19 日
for the next step in my assignment i need to find the correlation between two newly converted 1 x 1 cell arrays and i get an error message when I try to calculate the coefficient of both cell arrays.
Walter Roberson
Walter Roberson 2017 年 6 月 19 日
Correlation cannot be applied directly to cell arrays: you have to index the content of the cell arrays.
Richard Wilson
Richard Wilson 2017 年 6 月 20 日
how?
Walter Roberson
Walter Roberson 2017 年 6 月 20 日
編集済み: Walter Roberson 2017 年 6 月 20 日
Using { } indexing.
xcorr(FirstCell{1}, SecondCell[1})

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

Walter Roberson
Walter Roberson 2017 年 6 月 19 日

0 投票

Perhaps you mean,
output = {YourArray};
or perhaps you mean
output = num2cell(YourArray);

カテゴリ

タグ

質問済み:

2017 年 6 月 19 日

編集済み:

2017 年 6 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by