Vectors must be the same length
Mostrar comentarios más antiguos
Hi, i have following code with an error: Vectors must be the same length, but i think they are all 143x10498 double.
clc
clear all
clear workspace
load('ModellD_DOK_L1.mat')
C = table2array(ModellDL1WSPL);
CC = split(C,[" ",", "]); % double delimiters split
% CC(1:10,1:10) % show first 10 columns of first 10 rows
% ans = 10×10 string array
CCC=strrep(CC,',','.');
CCC=str2double(CCC);
Z = CCC([287:429],[5:2:20999]);
HQ5000 = CCC([1:143],[5:2:20999]);
HQextrem = CCC([430:572],[5:2:20999]);
HQ10000 = CCC([144:286],[5:2:20999]);
Distanz= CCC([1:143],[4:2:20999]);
for i=1:143
if rem(i-1, 5) == 0;
f = figure;
end
sgtitle('WSPL zeitlicher Verlauf Modell D Teil 1');
a(i)=subplot(5, 1, rem(i-1, 5)+1);
hold on;
% [maxHQextrem,indexHQextrem]=max(Hoehe_HQextrem(:,i)- Hoehe_Z(:,i));
% [maxHQ5000,indexHQ5000]=max(Hoehe_HQ5000(:,i)- Hoehe_Z(:,i));
% [maxHQ10000,indexHQ10000]=max(Hoehe_HQ10000(:,i)- Hoehe_Z(:,i));
%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)
p1=plot (Distanz(i,:) , [Z(i,:), HQextrem(i,:), HQ5000(i,:), HQ10000(i,:)]);
title(['Zeit [h] ', num2str(i)]);
grid on
% xline(indexHQextrem,'-','Maximum','LabelOrientation','horizontal')
% xline(indexHQ5000)
% xline(indexHQ10000)
leg=legend(p1,{'Geländehöhe','HQextrem','HQ5000', 'HQ10000'});
title(leg,'WSPL');
newcolors = {'#000000','#7E2F8E','#0000FF','#00FFFF'};
colororder(newcolors)
xlabel('FKM [km]');
ylabel('Höhe über NN [m]');
xticks([770.62 1538.58 2598.14 3716.89 4674.76 5588.47 6625.1 7535.71 8508.76 9476.3 9562.62])
xticklabels({'126','125','124','123','122','121','120', '119', '118', '117', '116'})
% if rem(i-1, 5) == 4
% %saveas(f,sprintf('hours_%d.png',i));
% saveas(f,sprintf('DOK_Links_Arc1_hours_%d.fig',i));
% end
end
Thanks a lot for your time
2 comentarios
KSSV
el 12 de Mayo de 2022
Which line you are getting error? We don't have data to chek your code.
Frederik Reese
el 12 de Mayo de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!