How to sort Data from an Excel File...

조회 수: 20 (최근 30일)
Lauren Kilgore
Lauren Kilgore 2019년 11월 21일
댓글: Walter Roberson 2019년 11월 25일
I am wanting to create a code that will read from an Excel file (I have attached an example below). I want the total number of students, check-in types to be sorted, and for the date and time to be sorted. I am very new to Matlab and this would help make my job much easier!
[~,~,rawData] = xlsread('matlabproject.xlsx');
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 11월 21일
mask = ismember(rawData(:,3), {'Student Check-In (DB)', 'Student Check-Out (DB)'});
student_subset = rawData(mask,:);
Now you can start processing to find the unique column 2 (names) in student_subset and so on.
Lauren Kilgore
Lauren Kilgore 2019년 11월 21일
Hi Walter,
Thank you so much! It works! Would you possibly know how to sort the date and time or direct me to some reasources to figure it out?
Thanks,
Lauren

댓글을 달려면 로그인하십시오.

채택된 답변

Siriniharika Katukam
Siriniharika Katukam 2019년 11월 25일
Hi
You may find a way to sort date and time from this link below:
May be you need to change the format in "datenum"
  댓글 수: 2
Lauren Kilgore
Lauren Kilgore 2019년 11월 25일
Thank you! I will look into this.
Walter Roberson
Walter Roberson 2019년 11월 25일
If you switch from xlsread() to readtable() then the first variable in the table will automatically be created as datetime() objects

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by