histc problem
3 次查看(过去 30 天)
显示 更早的评论
Hi, I have a matrix as follows:
I =
1 1 1 8 8 1 2
1 8 8 8 8 2 1
1 8 8 8 2 1 1
1 8 8 8 1 1 1
2 2 2 1 1 1 1
2 2 2 1 1 1 1
then the following code give me a error:
index= I==8; histc(index(:),1)
gives the follwing error.
??? Error using ==> histc First input must be non-sparse numeric array.
How to solve this?
Thanks
0 个评论
回答(1 个)
Walter Roberson
2011-6-7
I'm not sure what you think you are going to accomplish with that, but
index = 0 + (I==8);
histc(index(:),1)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!