Compare two vector arrays and if they match set vector array 2 = nan?
1 view (last 30 days)
So i have two arrays the same size:
time = [0,0,0,0,2,3,4,5,5,6,7,8]';
solution = [1,2,0,0,1,1,2,2,2,0,0,0];
What would be the best way to compare the two and if both are the same make solution 0 = nan;
So the final outcome i would like is solution = [1,2,nan,nan,1,1,2,2,2,0,0,0];
would i use a function such as:
Thanks in adavnce!
Walter Roberson on 11 Feb 2022
time = [0,0,0,0,2,3,4,5,5,6,7,8]
solution = [1,2,0,0,1,1,2,2,2,0,0,0]
outcome = solution;
outcome(solution == 0 & time == 0) = nan
It is not clear what you want to have happen in positions where the values are equal, but the values are not 0.