Elements in a matrix
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Maik Petersen
il 4 Gen 2014
Risposto: Maik Petersen
il 4 Gen 2014
Hello,
When I have a certain matrix, is there a possibility to check whether some value is on more than one position in the matrix.
So for example the identity matrix 3-by-3, how can I check whether the value '1' is multiple times there in the matrix?
Thanks in advance.
0 Commenti
Risposta accettata
Più risposte (2)
Walter Roberson
il 4 Gen 2014
sum(TheMatrix(:) == TheValue) > 1
In the more general case where you want to know whether any value is repeated, see unique()
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!