Plotting matrix data without existing x-values.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sergio
am 28 Feb. 2024
Kommentiert: Aquatris
am 28 Feb. 2024
I have this simple matrix, where the first column indicates the number of males of age 0 to 99 (first row, age 0, second row age 1 etc.)
The second column indicates the same for women.
How can I plot this nicely?
Thanks
0 Kommentare
Akzeptierte Antwort
Stephen23
am 28 Feb. 2024
S = load('befolkning2019.mat');
M = S.befolkning2019
X = 0:size(M,1)-1;
plot(X,M)
legend('male','female')
2 Kommentare
Aquatris
am 28 Feb. 2024
S = load('befolkning2019.mat');
M = S.befolkning2019;
X = 0:size(M,1)-1;
bar(X,M)
xlabel('age')
ylabel('# of People')
legend('male','female')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!