Change certain values in an array to a word
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Youssif Youssif
am 27 Okt. 2022
Kommentiert: Youssif Youssif
am 27 Okt. 2022
Hello, I have a certain array, 72221x1 (called time), and I want to configure it so if time/ every row does not have a value equal to -2,-10,-30,2,10,30, and another variable at which PP does not equal 0, the time array would output "outlier" at these locations, and replace the value that does not meet the condition.
1 Kommentar
Jan
am 27 Okt. 2022
What does "at which PP does not equal 0" mean? Is the time array a double vector? Then whar does 'output "outlier"' mean?
Akzeptierte Antwort
David Hill
am 27 Okt. 2022
Not sure why you want a mixed array of numbers and strings (not a good idea).
idx=~ismember(T,[-2 -10 -30 2 10 30])&PP~=0;%logical of time array meeting condition, logical true == "outlier"
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!