I have a question regarding the use of logical arrays or vectors in indexing.
As you can see in the attached .m-file, I have a couple of conditions, that I want to apply to the calculation of a vector.
I would like to apply this logical vector to the calculated vector, so that if the logical index says "1" (true) it keeps the respective value but
if the logical index says "0" (false) it deletes
the respective value.
Of course I could do this with some kind of nested for/if statement, but I think there would be a more elegant solution.
There is an example in the Octave Wiki (http://wiki.octave.org/Tips_and_tricks#Vectorizing_Tricks
) which is close to what I want to do, but I don't really understand the code in the example.
Maybe an explanation of the code example would also suffice for me to solve the problem on my own.
Normally I would do this with nested if-conditions inside a for-loop (also included in the attached file), but I'm trying to vectorize my code a bit more.
Thanks in advance for any help.