code without using for
Mostra commenti meno recenti
hi,
I want code do the following without using for,if let unique_x is a vector
t=1;
for v=1:length(z)
a1=find(unique_x==z(v));
if isempty(a1)
evaluation(t)=z(v);
t=t+1;
end
end
thanks in advance
2 Commenti
the cyclist
il 17 Mar 2013
It would be easier for us to help you if you supplied a small example of self-contained code that runs from start to finish. Specifically, telling us a small example of unique_x and z would help.
huda nawaf
il 17 Mar 2013
Risposta accettata
Più risposte (1)
Walter Roberson
il 17 Mar 2013
setdiff(z, unique_x)
provided that you do not care about the order of the results, and there are no duplicate values in z.
1 Commento
huda nawaf
il 17 Mar 2013
Categorie
Scopri di più su Loops and Conditional Statements 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!