Evaluating Excel Data to organize data
1 view (last 30 days)
Show older comments
I am trying to evaluate the Excel file but am unsure of how to get the values for the criteria below... I know how to import the Excel file but not sure if I need to make it a cell or table. I have never plotted a pie chart in MatlabAny help is appreciated!
-The name of the 20th runner.
-The home town and state of the last runner.
-The age of the first runner (winner).
-The first letter in the 5th runner's name.
-Count the number of males and females in the race.
-Display the age of youngest runner
-Display the age of oldest runner
-Create a pie chart that shows the percentage of male and female runners.
0 Comments
Answers (1)
Navya Seelam
on 6 Dec 2019
Hi,
You can use importdata to load file into workspace which gives you a structure with fields data and textdata. You can use cell2mat to convert cell array to string array.
T= importdata('marathon.xlsx');
gender=T.textdata(:,4);
gender=cell2mat(gender);% to convert cell array to string array
maleCount=size(find(gender=='M'),1);
femaleCount=size(find(gender=='F'),1);
Once you have male and female count you can easily create pie chart. Refer to this link to create pie chart.
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!