ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

in formula node how to use array outputs

someone has talked about this. but it is still a problem to me.
no matter how i declare the variable, the output terminal keeps a scalar.
0 Kudos
Message 1 of 5
(3,118 Views)
You should be able to declare it using:
int32 VarName[x][y];

That should make an array of 32bit integers.

See one of my earlier posts here: http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000EE2C0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_TIER_0=0&USEARCHCONTEXT_TIER_S=0&USEARCHCONTEXT_QUESTION_0=array+formula+node&USEARCHCONTEXT_QUESTION_S=0

Try copying the code that I posted into your formula node and see if you get an array out. Or try the example I attached with the same code in it.

Let us know if you are still having trouble.

Brian
0 Kudos
Message 2 of 5
(3,118 Views)
You example works. Thank you. Two more question:
1. Can we declare a float (single or double) array output? When I changed "int32" into "dbl", the output "y" also turned into DBL. But it was not an array anymore.
2. In your example, there is a 'for' loop to assign a value to each component in array "y". Is this 'for' loop necessary? I mean, can we do it like that polymorphic way?
0 Kudos
Message 3 of 5
(3,118 Views)
Ok, I got the answer for the first question after I read another post.
Thanks.
0 Kudos
Message 4 of 5
(3,118 Views)
I'm not sure what you mean by polymorphc way. If you mean like how you can input an array to a LV Add function on the block diagram and it will automatically perform the addition on all of the elements, then the answer is no I don't think so. If you want to perform an action on every item in the array then I think that you need some sort of loop.

Brian
0 Kudos
Message 5 of 5
(3,118 Views)