I want to copy a matrix to a cell array

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

 채택된 답변

Vishal Rane
Vishal Rane 2012년 12월 6일
편집: Vishal Rane 2012년 12월 6일

1 개 추천

Use
B = num2cell(A)
Refer num2cell

댓글 수: 1

Oh perfect. That's a wow Vishal. Thanks so very much :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by