Displaying the most number of counts
Show older comments
A=
'' 'c1' 'c2' 'c3' 'c4' 'c5'
'yar12' 'hi' 'hello' 'hi' 'hello' 'hi'
'yar13' hello' 'hi' 'hi' 'hello' 'hi'
'yar14' 'hi' 'hi' 'hi' 'hello' 'hello'
'yar15' 'hello' 'hi' 'hi' 'hi' 'hi'
'yar16' 'hello' 'hi' 'hi' 'hello' 'hello'
'yar17' 'hi' 'hi' 'hi' 'hi' 'hi'
With respect to c1 i want to display only the same value(as c1 value) having more than 2 counts for example
'yar12' has 'hi'(considering c1 as value) thrice(c1 to c5) so i want to display
'yar12' 'hi' 'hello' 'hi' 'hello' 'hi'
yar13 should no be considered because its has 'hello'(considering c1 as value) twice (from c1 to c5)twice,so i need output as
'yar12' 'hi' 'hi' 'hi'
'yar14' 'hi' 'hi' 'hi'
'yar16' 'hello' 'hello' 'hello'
'yar17' 'hi' 'hi' 'hi' 'hi' 'hi'
please provide assistance
6 Comments
Jan
on 19 Jul 2012
Sorry, kash, what exactly is the problem? "With respect to c1 i want to display only the same value having more than 2 counts for ex" is not clear in any way. "It has 'hello' only twice" is not understandable also.
Please post the example data in valid Matlab syntax, wuch this they can be used for experiments by copy&paste. The data you have posted could be a cell string, but the first line has another number of elements than the 2nd one. But even cell matrices must be rectangular.
Therefore I ask you for clarifications - inserted by editing the question, not in the comment or answer section. Thanks.
Jan
on 19 Jul 2012
Thanks for editing your question.
Walter Roberson
on 19 Jul 2012
This seems to me to be exactly the same question as the one about counting of u/d -- a question that got several good responses. That question appears to have disappeared, taking the responses with it :(
Walter Roberson
on 20 Jul 2012
My mistake: the u/d questions were by Pat. The techniques are exactly the same though.
Jan
on 20 Jul 2012
The similarities between kash's and Pat's question are surprising. @Pat and kash: Are you working on the same problem?
Walter Roberson
on 20 Jul 2012
In the past, kash and Pat were taking exactly the same course at the same location (they indicated), and yet their assignments were not always exactly the same. My speculation would be that they are still taking the same course together but that the instructors give each student slightly different assignments.
Accepted Answer
More Answers (0)
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!