how to count number of states in sequence?
1 次查看(过去 30 天)
显示 更早的评论
Suppose I have a sequence 1,3,3,1,2,1,4,2,3,1,4,2,4,4,4,3,1,2,5,1 in this 5 states are there, so how to count that there are 5 states.
0 个评论
回答(1 个)
Azzi Abdelmalek
2016-5-5
编辑:Azzi Abdelmalek
2016-5-5
a=[1,3,3,1,2,1,4,2,3,1,4,2,4,4,4,3,1,2,5,1]
out=unique(a)
number_of_states=numel(out)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Markov Chain Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!