This is crazy, have been stuck on this MATLAB code for ages. What I've got is the following:
for i = 1 : 0.1 : 5
index = find(someArray == i)
%do stuff
end
Now the first time the loop runs, when i = 1, index returns a correct value (e.g. 45). Now, the second time the loop runs, index gets set to an empty set of brackets - '[]' ...! (The same happens for the rest of the iterations).
This is crazy because starting the loop at 1.1 sets index to a logical numerical value. In fact, every iteration should set a logical value for index using find. So it's like 'find' doesn't like being used inside loops or something....
Any ideas or help is much appreciated!