Evaluating Excel Data to organize data

1 回表示 (過去 30 日間)
Lauren Kilgore
Lauren Kilgore 2019 年 12 月 3 日
回答済み: Navya Seelam 2019 年 12 月 6 日
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.

回答 (1 件)

Navya Seelam
Navya Seelam 2019 年 12 月 6 日
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.

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by