Change certain values in an array to a word

1 次查看(过去 30 天)
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 个评论
Jan
Jan 2022-10-27
What does "at which PP does not equal 0" mean? Is the time array a double vector? Then whar does 'output "outlier"' mean?

请先登录,再进行评论。

采纳的回答

David Hill
David Hill 2022-10-27
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"
  5 个评论
David Hill
David Hill 2022-10-27
A number flag like inf or -inf
a=[1 2 -inf 3 5 inf]
a = 1×6
1 2 -Inf 3 5 Inf

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by