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

16 次查看(过去 30 天)
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 中查找有关 Testing Frameworks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by