I want to copy a matrix to a cell array

2 Ansichten (letzte 30 Tage)
AbdulQadir Shabbir
AbdulQadir Shabbir am 6 Dez. 2012
Hi All, As said, suppose i have
A = [1 2;3 4] %A simple matrix
and
B = cell(2,2) %A simple 2*2 cell array
I want to copy the contents of A into B. I don't want to use for loops etc. There should be a direct way, but atleast I cannot find that. Would appreciate if someone can help here. Thanks, AQ

Akzeptierte Antwort

Vishal Rane
Vishal Rane am 6 Dez. 2012
Bearbeitet: Vishal Rane am 6 Dez. 2012
Use
B = num2cell(A)
Refer num2cell
  1 Kommentar
AbdulQadir Shabbir
AbdulQadir Shabbir am 7 Dez. 2012
Oh perfect. That's a wow Vishal. Thanks so very much :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by