Keep positive real values from a cell inside a matrix
Afficher commentaires plus anciens
Hi,
I have a matrix 21x13. Inside every cell there are 26 complex values.
I want to keep only the real positive parts of those complex values and plot a 3d graph having in one axis the real positive values, in the other axis the number of matrix rows (1-21)and on the third axis the number of matrix columns(1-13).
Thank you.
2 commentaires
Guillaume
le 12 Juil 2019
So, you want to plot points at coordinate X, Y, Z with X and Y from 1 to 21 and 1 to 13, and Z is what? One of the 25 or 26 number for that X and Y? All the 25/26 points (so you'd have columns of point at each X and Y?
Shouldn't the first row of that cell array be made of 26x1 vectors? Just like all the other rows. In which case, the data would be better stored as a 21x13x26 3D array, which would be faster to manipulate, use less memory and a lot simpler to use.
Ilias Minas
le 12 Juil 2019
Réponse acceptée
Plus de réponses (1)
KSSV
le 11 Juil 2019
Let A be your cell.
Convert cells into matrix using:
A = cell2mat(A) ;
Pick the real parts of A using:
A = real(A) ;
Pick the posititve reals using:
A(A<0) = NaN ;
surf(A)
3 commentaires
Ilias Minas
le 11 Juil 2019
KSSV
le 11 Juil 2019
for i = 1:21
for j = 1:13
Ai = A{i,j} ;
% do what you want
end
end
Ilias Minas
le 12 Juil 2019
Catégories
En savoir plus sur Scatter Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!