Change certain values in an array to a word

조회 수: 1 (최근 30일)
Youssif Youssif
Youssif Youssif 2022년 10월 27일
댓글: Youssif Youssif 2022년 10월 27일
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
Youssif Youssif
Youssif Youssif 2022년 10월 27일
Thank you very much, it looks good now

댓글을 달려면 로그인하십시오.

추가 답변 (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