Why sprint doesn't show a zero value from an array?
Afficher commentaires plus anciens
I have the following code, and when I run everthing works perfectly except in the third column of the figure, the title of the histrogram should show zero instead of -14.

u_0=randi(4000,4000);
p=[0 3 7 30 33 36 56 60 64];
c=[-14 -12 -8;-8 -6 -4;0 0 0];
z=[60 40 20;60 40 20;60 40 20];
fig1=figure('Name','Fig 1');
fig1.WindowState = 'Maximized';
a=[1:450:2251];
for s=1:1:9
subplot(3,3,s)
for r=a(:)+p(s)
f1=u_0(:,r);
f1(f1==0)=NaN;
if s==1 || s==4 || s==7
edge=(0:1:25);
elseif s==2 || s==5 || s==8
edge=(0:4:90);
else s=3 | s==6 | s==9;
edge=(0:10:250);
end
hold on
h1=histogram(f1(:,1),"NumBins",20,'Normalization','pdf',"BinEdges",edge);
h2=histogram(f1(:,4),"NumBins",20,'Normalization','pdf',"BinEdges",edge);
h3=histogram(f1(:,6),"NumBins",20,'Normalization','pdf',"BinEdges",edge);
hold off
title(sprintf('D, (25^{o}C,%d,%d)',c(s),z(s)));
end
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical 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!