How to fill a Cellarray with the real components of a matrix

hi everyone, I have the following matrix and want to create a Cellarray with contents the real component of the Matrix. my code doesnt work:
[m n]=size(Mat);
C=cell(m,n);
for h = 1:m
for l=1:n
C(h,l) = real(Mat(h,l));
end
end
I got the error "Conversion to cell from double is not possible."
thank you in advance

 Respuesta aceptada

Avoid the loop. This works:
C = real(Mat);

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Sept. de 2015

Comentada:

el 12 de Sept. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by