Is the find function a robust method to determine the number of specific values in a Matrix?
Mostra commenti meno recenti
Hello!
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); % A3 is the threedimensional matrix
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!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!