03-24-2007 07:21 AM
03-24-2007 12:01 PM
03-24-2007 12:20 PM - edited 03-24-2007 12:20 PM
Message Edited by MariaIre on 03-24-2007 12:21 PM
Message Edited by MariaIre on 03-24-2007 12:22 PM
03-24-2007 12:57 PM
03-24-2007 01:15 PM
03-24-2007 01:29 PM - edited 03-24-2007 01:29 PM
So, things are probably much simpler than they seem at the moment. 🙂
Message Edited by altenbach on 03-24-2007 11:31 AM
03-24-2007 01:42 PM
03-24-2007 02:57 PM - edited 03-24-2007 02:57 PM
If you just want to zero element at corresponding locations where the "PC..." array is 1, you don't need to generate the array of indices, you don't even need a loop.
Due to the inherent potential problems comparing DBL values, the "PC ..." array should probably be integer. It only contains integer values anyway. Right?
Assuming that the "PC..." and data Array are of equal size, you can for example use a simple loopfree solution as shown in the picture. If you really also want an array output showing the replaced indices, you could do something like is shown in the optional part of my code.
Message Edited by altenbach on 03-24-2007 12:57 PM
03-25-2007 02:44 AM
03-25-2007 03:13 AM
tbd wrote:Are you sure you want to search for a zero in the for-loop?
Yes! Why not? 🙂
(We do a !=0, so all replacements will have a zero in the 0:1 array. The 1s are the elements we did not touch. We don't care about those. ;). Remember, I search the "?0:1" array, not the original array.)