How to count number of states in array?
3 views (last 30 days)
Show older comments
Hi,
I want to count number of states in vector, each number represent a state: Ex.
A = [1;1;0;1;0]
B = [2;2;1;0;1]
C = [1;1;1;1;1]
A has two states 1 and 0 ==> k=2, B has three states 1, 2, 0 ==> k=3, and C has zero state ==> k=0. how can I write a proforma to define k (number of states)?
3 Comments
Walter Roberson
on 4 Jun 2017
If necessary, my suggestion could be followed by testing if the result was 1, and if so then change it to 0.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Logical 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!