>Hi All,
>
>I'm trying to replace the values in 1 dimension of a 2 dimensional
>array with values from a 1 dimensional array.
>
Use a formula object:.
As inputs : a= 2D array, b = 1D array
Formula: a[1,*] = b
As outputs : a
It is important to specify a new output pin with the same name as the input
pin for the 2D array to have the changed 2D array accessible at the output
of the formula object. The default RESULT pin does not contain the changed
2D array.
Mike Asbery
***********************************************************
Michael N. Asbery, NRL Code 5733.20, (202)767-3025, DSN 297
michael.asbery@nrl.navy.mil fax (202)404-7661
***********************************************************
>
>I'm trying to replace the values in 1 dimension of a 2 dimensional
>array with values from a 1 dimensional array.
>
Use a formula object:.
As inputs : a= 2D array, b = 1D array
Formula: a[1,*] = b
As outputs : a
It is important to specify a new output pin with the same name as the input
pin for the 2D array to have the changed 2D array accessible at the output
of the formula object. The default RESULT pin does not contain the changed
2D array.
Mike Asbery
***********************************************************
Michael N. Asbery, NRL Code 5733.20, (202)767-3025, DSN 297
michael.asbery@nrl.navy.mil fax (202)404-7661
***********************************************************
>
> Hi All,
>
> I'm trying to replace the values in 1 dimension of a 2 dimensional
> array with values from a 1 dimensional array.
>
> Other than looping thru the arrays, replacing 1 element at a time, is
> there a better way to do this?
>
> :-:--------------------------:-:
> : Bill Drago :
> | L3 Communications |
> : Narda Microwave-East :
> | Hauppauge, NY 11788 |
> : William.Drago@L-3Com.com :
> | 516-231-1700 x572 |
> :-:--------------------------:-:
Yes:
+--------------------------------+ +----------------------+
| Generate 1D Array | | Formula |
+--------------------------------+ +----+-----------------+
| randomize( ramp(10,0,0),0,50 ) +----->| A1 | [ A1, A2[1,*] ] +--->
+--------------------------------+ +-->| A2 | |
| +----+-----------------+
|
+-----------------------------------+
|
+--------------------------------------------------------------------+ |
| Generate 2D Array | |
+--------------------------------------------------------------------+ |
| [ randomize(ramp(10,0,0),50,100), randomize(ramp(10,0,0),100,150)] +--+
+--------------------------------------------------------------------+
Don't worry about the boxes with the "randomize(ramp)" statements in them,
they just generate arrays with random contents (in distinct ranges so
you know which is which). The Formula box is the important item.
This Formula swaps the first row of the array. You can swap the second
with:
[ A2[0,*], A1 ]
[%%] regards -- gvg
--
Greg Goebel ftp://fcext3.external.hp.com/dist/mxd/index.html
HP MXD Marketing http://hpislsup.lvld.hp.com (HP only)
pctm@lvld.hp.com http://www.geocities.com/CapeCanaveral/Launchpad/6000