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

1 vue (au cours des 30 derniers jours)
Paul Nanfah
Paul Nanfah le 12 Sep 2015
Commenté : Star Strider le 12 Sep 2015
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

Réponse acceptée

Star Strider
Star Strider le 12 Sep 2015
Avoid the loop. This works:
C = real(Mat);
  2 commentaires
Paul Nanfah
Paul Nanfah le 12 Sep 2015
it does work ,thank you
Star Strider
Star Strider le 12 Sep 2015
My pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by