Finding whether a value is equal to the value of any array element in MATLAB
- by James
Hi,
Can anyone tell me if there is a way (in MATLAB) to check whether a certain value is equal to any of the values stored within another array?
The way I intend to use it is to check whether an element index in one matrix is equal to the values stored in another array (where the stored values are the indexes of the elements which meet a certain criteria).
So, if the indices of the elements which meet the criteria are stored in the matrix below:
criteriacheck = [3 5 6 8 20];
Going through the main array (called array) & checking if the index matches:
for i = 1:numel(array)
if i == 'Any value stored in criteriacheck' ... "Do this"
end
Does anyone have an idea of how I might go about this?
Thanks in advance