How do I plot specific data from an export excel file?

4 views (last 30 days)
Wong En Xin
Wong En Xin on 27 Oct 2020
Commented: Wong En Xin on 28 Oct 2020
I have a excel file with data which contains category and value. For example: Canada---3---30, Canada---4---40, Italy---3---20
I would like to plot the data only for the country I want, I use 'location=input('location=')', and would like the graph to only show the data for the location I typed for my plot(x,y).
How should I do that? Thank you.
  1 Comment
Sudhakar Shinde
Sudhakar Shinde on 27 Oct 2020
You can use readtable and plot / bar functions. You could add excel data example and what you have written meanwhile to achieve this question.

Sign in to comment.

Answers (1)

Sudhakar Shinde
Sudhakar Shinde on 27 Oct 2020
Example:
Then you need plot of Value1 vs Value2 of country 'Canada' :
table=readtable('test1.xlsx');
Data= contains((table.Country),'Canada');
plot(table.Value1(Data),table.Value2(Data);)
  6 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!