How do I make an if statement based on whether an index is part of a vector of numbers?
14 views (last 30 days)
Hi, I am using MATLAB R2020a on a MacOS. I am trying to write an 'if' statement such that a command is executed if the index of the for loop if not a part of a vector of values. I have a vector 'abnormal_attractors' which has the index positions of indices that I do not want the command to be executed. I only what the command to be executed for all the index positions apart from these values.
I would very much appreciate any suggestions. Thanks in advance
for currentcycle = 2:length(number_cycles)
abnormal_attractors = [95, 94, 93, 92, 91, 90, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 67, 66, 65, 64, 25, 24, 23, ...
5, 4, 2];
% if currentcycle is not a member of abnormal_attractors vector, then
% execute following 2 lines
previous_expmean_v = current_expmean_v;
previous_expmean_w = current_expmean_w;