Graph with string variable

조회 수: 1 (최근 30일)
Zongo Amara Mohamed Isaac
Zongo Amara Mohamed Isaac 2019년 6월 19일
댓글: Jan 2019년 6월 24일
Hey guys,
I've just become very familiar with Matlab, but I'm having trouble building a graph:
on the X axis I would like to have the years and the values of the exports of manufactirial and food goods in order.
I don't know the code to use
thanking you in advance
attached my file

채택된 답변

Zongo Amara Mohamed Isaac
Zongo Amara Mohamed Isaac 2019년 6월 19일
Thank you so much..it works...
  댓글 수: 1
Jan
Jan 2019년 6월 24일
Please post comments to an answer in the section for comments to an answer and select the answer, which solves the problem as accepted answer, not your comment. Then the readers knwo, which solution is working.

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

추가 답변 (2개)

Jan
Jan 2019년 6월 19일
You did not even make an attempt?
data = readmatrix('data.xlsx');
plot(data(:, 1), data(:, 2), 'r', ...
data(:, 1), data(:, 3), 'b');

Star Strider
Star Strider 2019년 6월 19일
Try this:
[D,S] = xlsread('data.xlsx');
Years = str2double(S(2:end,1));
figure
plot(Years, D)
grid
legend(S(1,2:3))
producing:
Graph with string variable - 2019 06 19.png
  댓글 수: 1
Star Strider
Star Strider 2019년 6월 19일
@Zongo Amara Mohamed Isaac —
If my Answer helped you solve your problem, please Accept it!

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by