How do I plot specific data from an export excel file?
조회 수: 2 (최근 30일)
이전 댓글 표시
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개)
Sudhakar Shinde
2020년 10월 27일
Example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/393683/image.png)
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
Sudhakar Shinde
2020년 10월 28일
편집: Sudhakar Shinde
2020년 10월 28일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Bar Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!