필터 지우기
필터 지우기

Plotting matrix data without existing x-values.

조회 수: 3 (최근 30일)
Sergio
Sergio 2024년 2월 28일
댓글: Aquatris 2024년 2월 28일
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

채택된 답변

Stephen23
Stephen23 2024년 2월 28일
S = load('befolkning2019.mat');
M = S.befolkning2019
M = 100x2
59476 55907 60993 57783 61598 58432 63965 60716 63535 59313 64161 60408 63519 59816 63972 60569 63414 60057 65919 62249
X = 0:size(M,1)-1;
plot(X,M)
legend('male','female')
  댓글 수: 2
Sergio
Sergio 2024년 2월 28일
Thanks! This is great!
Aquatris
Aquatris 2024년 2월 28일
you can also check here for different types of plots. For your case bar might be useful as well
S = load('befolkning2019.mat');
M = S.befolkning2019;
X = 0:size(M,1)-1;
bar(X,M)
xlabel('age')
ylabel('# of People')
legend('male','female')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by