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'
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Testing Frameworks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!