06-27-2006 08:55 AM
06-27-2006 09:03 AM
my 2 sets of arrays look like this:
Set 1
1.5 2.5 3.5
10 20 30
Set 2
1.5 2.5 3.5
1 2 3
What I want to do is subract the second dimension of set 2 from set 1 to get the following resultant 2d array
Resultant array
1.5 2.5 3.5
9 18 27
Thanks,
Phil
06-27-2006 10:14 AM - edited 06-27-2006 10:14 AM
Message Edited by Anthony_Wong on 06-27-2006 10:25 AM
06-27-2006 10:25 AM - edited 06-27-2006 10:25 AM
Another option. You can work with 1D arrays then build it up again

David
Message Edited by David Crawford on 06-27-2006 04:26 PM
06-27-2006 10:26 AM - edited 06-27-2006 10:26 AM
Message Edited by SarahB on 06-27-2006 10:28 AM
06-27-2006 10:31 AM - edited 06-27-2006 10:31 AM
Message Edited by Novatron on 06-27-2006 11:32 AM
06-27-2006 10:33 AM
06-27-2006 10:58 AM
@Anthony_Wong wrote:
I suspected that the subtract function was flexible and edited my post to reflect that (i.e. rather than extracting the elements individually, just simply subtract the two subarrays).
Thanks for the tip though Novatron.
This flexibility is called "polymorphism". I think most if not all arithmetic (numeric functions) operators are polymorphic. It's a handy thing to know about.
If you encounter a non-polymorphic function, and you want to apply it to a whole array you have to index into the datatype, somehow (usually using a for or while loop with indexing enabled, and iterate the whole length of the array),
06-27-2006 11:26 AM - edited 06-27-2006 11:26 AM

Message Edited by altenbach on 06-27-2006 09:27 AM
06-27-2006 01:54 PM