How to solve 'Error using image Complex values are not supported. Specify the color data as numeric or logical values.'
Afficher commentaires plus anciens
Hi
I have attached my data S_OPT.mat having size SW_OPT (115 200) and VD (115 1);
The problem is some array in SW_OPT are complex number and I want to plot probability as given by my code:
x22 = [0.0:0.001:1]';
Prob_SW = zeros(length(VD), length(x22));
for i=1:length(VD)
Prob_SW(i,:) = ksdensity(SW_OPT(i,:),x22);
Prob_SW(i,:) = Prob_SW(i,:)/sum(Prob_SW(i,:));
end
figure(6), imagesc([0.0:0.001:1], VD, Prob_SW); xlabel('S_w (m/s)');
axis([1 1 1.888e+03 2.131e+03]); set(gca,'ytick',[1.888e+03:55:2.131e+03]);
set(gca,'xtick',[0:0.5:1]); set(gca,'FontSize',9); ylabel('Depth (m)'); colorbar;
set(gcf, 'position', [1200 285 200 410]);
colorbar;
But following error appears
Error using image
Complex values are not supported. Specify the color data as numeric or logical values.
Error in imagesc (line 52)
hh = image(varargin{:}, 'CDataMapping', 'scaled');
Error in UQ_PLOT_4D (line 195)
figure(6), imagesc([0.0:0.001:1], VD, Prob_SW); xlabel('S_w (m/s)');
How can I solve this problem? I want to obtain a figure like this

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Images 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!