Find the number of occurences of diffrent individuales in a cell array

조회 수: 2 (최근 30일)
Yomiran Nissan
Yomiran Nissan 2021년 7월 18일
편집: Image Analyst 2021년 7월 18일
If there is a cell array that is bulit from 2 columns in this manner - the first column containing indexing numbering 1...N, and the second one has strings.
How can I check how many times, each index is matched to a string?
Example of the cell array:
{[1]} {'Dad'}
{[1]} {'Dad'}
{[1]} {'Mom'}
{[1]} {'Me'}
{[1]} {'Me'}
{[1]} {'Mom'}
{[2]} {'Brother'}
{[2]} {'Mom'}
{[2]} {'Dad'}
{[2]} {'Sister'}
{[2]} {'Sister'}
{[2]} {'Sister'}
.
.
.
{[68]} {'Me'}
{[68]} {'Mom'}
{[68]} {'Brother'}
{[68]} {'Mom'}
{[68]} {'Dad'}
{[68]} {'Sister'}
{[68]} {'Me'}
{[68]} {'Sister'}
Thanks in advance!
Yomiran

답변 (1개)

Image Analyst
Image Analyst 2021년 7월 18일
편집: Image Analyst 2021년 7월 18일
I'd probably use some of these functions: contains(), ismember(), strfind(), strcmpi(). Good luck.
It would sure be a whole lot easier to provide you with a turnkey solution if you upload your cell array in a .mat file with the paperclip icon AFTER you read the posting guidelines (which you apparently skipped):

카테고리

Help CenterFile Exchange에서 Create Large-Scale Model Components에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by