How to find the occurrence of an element in a column of a table

조회 수: 14 (최근 30일)
Cem Akinci
Cem Akinci 2022년 5월 2일
댓글: Cem Akinci 2022년 5월 2일
I have a CSV file as shown below and i used readtable function to read it into a table in Matlab. There are several test cases and I need to count the total number of 'Passed' and 'Failed' test cases. I'm a bit stuck and don't know how to proceed.
TestCase Duration Status
__________________________________________________________ ______________ ________
'...................................' '5.1 sec' 'Passed'
'...................................' '2.4 sec' 'Failed'

채택된 답변

dpb
dpb 2022년 5월 2일
tYourTable.Status=categorical(tYourTable.Status); % more convenient thatn cellstr() in use
tCounts=groupsummary(tYourTable,'Status')
Look at the available functions from the link "Functions" at the top of the doc page for the table object -- it's a gold mine of how to process table data...

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by