I want to copy a matrix to a cell array

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

Accepted Answer

Vishal Rane
Vishal Rane on 6 Dec 2012
Edited: Vishal Rane on 6 Dec 2012
Use
B = num2cell(A)
Refer num2cell

More Answers (0)

Categories

Find more on Loops and Conditional Statements 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!