Legend of a plot out of table first row

7 visualizzazioni (ultimi 30 giorni)
Frederik Reese
Frederik Reese il 10 Mag 2022
Risposto: Voss il 11 Mag 2022
Hi
I have the attached table. I Plot in a for loop an want as a legend the first row of the table.
Can someone help me ?
Thanks
  2 Commenti
Riccardo Scorretti
Riccardo Scorretti il 10 Mag 2022
Your question is too vague: the table reads:
load Test_Table.mat
Test_Table
Test_Table = 21×1 table
Arc2ZTime00000000000450280 _____________________________________________ " Arc 2, Z, Time: 0 00:00:00→→0,260→450,285" " Arc 2, Z, Time: 0 00:00:00→→1,468→450,274" " Arc 2, Z, Time: 0 00:00:00→→2,798→450,275" " Arc 2, Z, Time: 0 00:00:00→→3,999→450,310" " Arc 2, Z, Time: 0 00:00:00→→5,202→450,320" " Arc 2, Z, Time: 0 00:00:00→→6,395→450,340" " Arc 2, Z, Time: 0 00:00:00→→7,591→450,342" " Arc 2, Z, Time: 0 00:00:00→→8,641→450,342" " Arc 2, Z, Time: 0 00:00:00→→9,835→450,348" " Arc 2, Z, Time: 0 00:00:00→→10,757→450,353" " Arc 2, Z, Time: 0 00:00:00→→11,942→450,330" " Arc 2, Z, Time: 0 00:00:00→→12,897→450,295" " Arc 2, Z, Time: 0 00:00:00→→15,207→450,519" " Arc 2, Z, Time: 0 00:00:00→→15,483→450,529" " Arc 2, Z, Time: 0 00:00:00→→15,707→450,532" " Arc 2, Z, Time: 0 00:00:00→→15,930→450,535"
What do you want to plot? Post the data, and a simple example of what you would like to obtain.
Frederik Reese
Frederik Reese il 10 Mag 2022
A= [1:196];
A = array2table (A)
%11: 16:51, 12: 52:84 13:85:117
%11:6:17, 12: 18:28, 13: 29:39
ModellD_BHQ = PegelpunktetimeseriesneuCopy(1:3:end, :)
ModellD_HQ5000 = PegelpunktetimeseriesneuCopy(2:3:end, :)
ModellD_HQ10000 = PegelpunktetimeseriesneuCopy(3:3:end, :)
ModellD_HQ10000 = removevars(ModellD_HQ10000, 'Linkes_Uferwspl_D_Ist_beidseitig');
ModellD_BHQ = removevars(ModellD_BHQ, 'Linkes_Uferwspl_D_Ist_beidseitig');
ModellD_HQ5000 = removevars(ModellD_HQ5000, 'Linkes_Uferwspl_D_Ist_beidseitig');
ModellD_HQ50001 = ModellD_HQ5000{:,1:84};
ModellD_HQ100001 = ModellD_HQ10000{:,1:84};
ModellD_BHQ1 = ModellD_BHQ{:,1:84};
for i=29:39
sgtitle('WSPL zeitlicher Verlauf Modell D Pegelpunkte FKM 113')
subplot(3,1,1)
plot(ModellD_BHQ{i,:})
hold on
grid on
title ('BHQ')
xlabel ('Zeit [h]')
ylabel ('WSPL [m]')
subplot(3,1,2)
plot(ModellD_HQ5000{i,:})
hold on
grid on
title ('HQ5000')
xlabel ('Zeit [h]')
ylabel ('WSPL [m]')
subplot(3,1,3)
plot(ModellD_HQ10000{i,:})
hold on
grid on
title ('HQ10000')
xlabel('Zeit [h]')
ylabel ('WSPL [m]')
end
This is my plot code and i want to plot the Names in the first row ( for example " 114 VL_L - wspl_D_Ist_beidseitig (3)") as legend for the data which are plot
is it clearer now?

Accedi per commentare.

Risposta accettata

Voss
Voss il 11 Mag 2022
I'm not sure where the legends are supposed to fit, but here you go:
S = load('PegelpunktetimeseriesneuCopy');
PegelpunktetimeseriesneuCopy = S.PegelpunktetimeseriesneuCopy;
ModellD_BHQ = PegelpunktetimeseriesneuCopy(1:3:end, :);
ModellD_HQ5000 = PegelpunktetimeseriesneuCopy(2:3:end, :);
ModellD_HQ10000 = PegelpunktetimeseriesneuCopy(3:3:end, :);
ax = [ ...
subplot(3,1,1) ...
subplot(3,1,2) ...
subplot(3,1,3) ...
];
title(ax(1),'BHQ')
title(ax(2),'HQ5000')
title(ax(3),'HQ10000')
hold(ax,'on')
grid(ax,'on')
xlabel(ax,'Zeit [h]')
ylabel(ax,'WSPL [m]')
h = [ ...
plot(ax(1),ModellD_BHQ{29:39,2:end}.') ...
plot(ax(2),ModellD_HQ5000{29:39,2:end}.') ...
plot(ax(3),ModellD_HQ10000{29:39,2:end}.') ...
];
leg = [ ...
legend(h(:,1),ModellD_BHQ{29:39,1}) ...
legend(h(:,2),ModellD_HQ5000{29:39,1}) ...
legend(h(:,3),ModellD_HQ10000{29:39,1}) ...
];
set(leg,'Interpreter','none','Location','EastOutside');
sgtitle('WSPL zeitlicher Verlauf Modell D Pegelpunkte FKM 113')

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by