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

2 visualizaciones (últimos 30 días)
Wong En Xin
Wong En Xin el 27 de Oct. de 2020
Comentada: Wong En Xin el 28 de Oct. de 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 comentario
Sudhakar Shinde
Sudhakar Shinde el 27 de Oct. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Sudhakar Shinde
Sudhakar Shinde el 27 de Oct. de 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 comentarios
Sudhakar Shinde
Sudhakar Shinde el 28 de Oct. de 2020
Editada: Sudhakar Shinde el 28 de Oct. de 2020
country = input('Input Country: ','s');
Data= contains((table.location),country); %Filter the data with location input
plot(table.days_tracked(Data),table.total_cases(Data)); %Plot days_tracked vs total_cases
% for input location
Above code lines will serve ur purpose.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by