histc problem
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 7 Jun 2011
I'm not sure what you think you are going to accomplish with that, but
index = 0 + (I==8);
histc(index(:),1)
2 Comments
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!