How do you count the number of occurences of a certain strin

How do you count the number of occurences of a certain string inside of a cell array in Matlab?

For example:

A = {\'hi\',\'hello\',\'hi\',\'hilo\'};

How would you count how many times the exact string \'hi\' occured?

How would you count how many times hi occured in the array?

How would you find the most similar string to \'silo\' in the array?

Solution

1 ) B = count(A,\'hi\')

2) B = count(A,\'hi\',\'IgnoreCase\',true)

3) B = count(A,\'ilo\',\'IgnoreCase\',true)

How do you count the number of occurences of a certain string inside of a cell array in Matlab? For example: A = {\'hi\',\'hello\',\'hi\',\'hilo\'}; How would y

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site