Subplot no values at individual subplots
显示 更早的评论
Hi,
do you know why there are no values for subplot 5 and seven?
Thanks in advance
clc
clear all
clear workspace
%load('Punkt_113.mat')
load('Punkt_120.mat')
Punkt_120(1:2,:) = [];
% Punkt_113 = table2array(Punkt_113);
% Punkt_113 = split(Punkt_113,[" ", " "]); % double delimiters split
% Punkt_113
% CC(1:10,1:10) % show first 10 columns of first 10 rows
% ans = 10×10 string array
% BHQ_113 = Punkt_113([1:10],[3:144]);
% HQ5000_113 = Punkt_113([1:10],[287:428]);
% HQextrem_113 = Punkt_113([1:10],[145:286]);
% HQ10000_113 = Punkt_113([1:10],[430:571]);
%
Punkt_120 = table2array(Punkt_120);
Punkt_120 = split(Punkt_120,[" ", " "]);
% CCC=strrep(CC,',','.');
% Punkt_113=str2double(Punkt_113);
Punkt_120=str2double(Punkt_120);
BHQ_120 = Punkt_120([1:11],[4:145]);
HQ5000_120 = Punkt_120([1:11],[288:429]);
HQextrem_120 = Punkt_120([1:11],[146:287]);
HQ10000_120 = Punkt_120([1:11],[430:571]);
Koordinaten_120= Punkt_120([1:11], [1:3])
Z= ones(11, 142);
A=[0:141]
% Z= 453.567 452.977 454.196 %Geländehöhe
for i=1:11
% if rem(i-1, 5) == 0;
% f = figure;
% end
sgtitle('WSPL zeitlicher Verlauf Pegelpunkt FKM 120');
a(i)=subplot(10, 1, rem(i-1, 5)+1);
hold on;
[maxHQextrem,indexHQextrem]=max(HQextrem_120(i,:)- Koordinaten_120(i,3));
[maxHQ5000,indexHQ5000]=max(HQ5000_120(i,:)- Koordinaten_120(i,3));
[maxHQ10000,indexHQ10000]=max(HQ10000_120(i,:)- Koordinaten_120(i,3));
str = ['Maximaler Überlauf [m]: HQextrem ',num2str(maxHQextrem),' HQ5000 ',num2str(maxHQ5000),' HQ10000 ',num2str(maxHQ10000)];
b(i) = annotation('textbox','String',str,'Position',a(i).Position,'Vert','bottom','FitBoxToText','on');
hold on
%annotation('textbox', 'String',str)
title(['Punkt ', num2str(i)]);
HQextrem_120(HQextrem_120<=(Z.*Koordinaten_120(i,3))-2)=nan;
HQ5000_120(HQ5000_120<=(Z.*Koordinaten_120(i,3))-2)=nan;
HQ10000_120(HQ10000_120<=(Z.*Koordinaten_120(i,3))-2)=nan;
BHQ_120(BHQ_120<=(Z.*Koordinaten_120(i,3))-2)=nan;
plot(A(1,:), BHQ_120(i,:))
hold on
plot(A(1,:), HQextrem_120(i,:))
plot(A(1,:), HQ5000_120(i,:))
plot(A(1,:), HQ10000_120(i,:))
yline(Koordinaten_120(i,3))
leg=legend('BHQ','HQextrem','HQ5000', 'HQ10000', 'Geländehöhe');
title(leg,'WSPL');
newPosition = [0.92 0.65 0.05 0.2];
newUnits = 'normalized';
set(leg,'Position', newPosition,'Units', newUnits);
newcolors = {'#FF00FF','#7E2F8E','#0000FF','#00FFFF'};
colororder(newcolors)
xlabel('Zeit [h]');
ylabel('Höhe über NN [m]');
grid on
set(gcf, 'Position', get(0, 'Screensize'));
end
3 个评论
dpb
2022-5-12
You're setting a lot of stuff to NaN it appears; NaN aren't plotted so if the data for those particular plots turns out to all be NaN you won't see anything...or if just one or two scatter points aren't NaN, there may not be sufficient resolution that the individual pixels are visible.
Use the debugger and set a breakpoint to stop after the given loop index that is a problem and see what your arrays contain...if it plots some but not all, it's bound to be data-dependent upon those particular subsets.
Frederik Reese
2022-5-13
dpb
2022-5-13
Well, the debugger is still your friend to figure out the logic error...
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Title 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!