Sorry for the confusing Question-Formulation, but I could not think of a better one.
I have simulation in which values of a threedimensional matrix are changed over time. I have also some axes which plot the current number of specific values in this matrix, e.g. values which are ==1 or >4 for example. The way I implemented it, is the following
vec = find(A3(:,:,:)==1);
num = length(vec);
So I just found all the entries with value 1 and then just calculated the length of the vector, which contains the position of all this specific entries with value 1. As per my understanding, this should work like this, but I somehow get weird plots sometimes and I am not sure it its because of my simulation or of this finding-method. Is the length of this vector always equal to the number of specific entries in the matrix? Or does the vector sometimes has some trivial null-entries, that could fudge with the results?
I am sorry for the specific question. Thanks a lot guys!