Graph with string variable
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Zongo Amara Mohamed Isaac
le 19 Juin 2019
Commenté : Jan
le 24 Juin 2019
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
0 commentaires
Réponse acceptée
Zongo Amara Mohamed Isaac
le 19 Juin 2019
1 commentaire
Jan
le 24 Juin 2019
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.
Plus de réponses (2)
Jan
le 19 Juin 2019
You did not even make an attempt?
data = readmatrix('data.xlsx');
plot(data(:, 1), data(:, 2), 'r', ...
data(:, 1), data(:, 3), 'b');
0 commentaires
Star Strider
le 19 Juin 2019
Try this:
[D,S] = xlsread('data.xlsx');
Years = str2double(S(2:end,1));
figure
plot(Years, D)
grid
legend(S(1,2:3))
producing:

1 commentaire
Star Strider
le 19 Juin 2019
@Zongo Amara Mohamed Isaac —
If my Answer helped you solve your problem, please Accept it!
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!