# Subplot no values at individual subplots

5 views (last 30 days)
Frederik Reese on 12 May 2022
Commented: dpb on 13 May 2022
Hi,
do you know why there are no values for subplot 5 and seven?
clc
clear all
clear workspace
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
dpb on 13 May 2022
Well, the debugger is still your friend to figure out the logic error...