Evaluating Excel Data to organize data

1 visualización (últimos 30 días)
Lauren Kilgore
Lauren Kilgore el 3 de Dic. de 2019
Respondida: Navya Seelam el 6 de Dic. de 2019
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.

Respuestas (1)

Navya Seelam
Navya Seelam el 6 de Dic. de 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.

Community Treasure Hunt

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

Start Hunting!

Translated by