LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array output from formula node with input variable as array size

Hi,

 

I have created a formula node with an array output called al, but I get an error "you have connected a scalar type to an array with that type".

 

I declare the output as follows..

float64 al[len_as];

 

where len_as is an scalar input to the formula node.

 

It only works when I put a number as.

float64 al[5];

 

,but I don't know beforehand how many elements I need, so I cannot use this.

 

Please help! This is so stupid.

 

Thanks

0 Kudos
Message 1 of 9
(7,323 Views)

Don't define your array in your formula node.

 

Initialize the array as the size you want and pass it in as an input into the formula node.

 

 

Are you sure you even need to use a formula node?  Can you implement your formula using all native LabVIEW functions?

Message Edited by Ravens Fan on 10-07-2009 11:51 PM
Message 2 of 9
(7,314 Views)

Great idea, thank you!

 

I'm implementing some Matlab code that uses nested for loops that access arrays at all kinds of indexes. I think it will just be a total mess if implemented with native LabView code.

 

Regards

0 Kudos
Message 3 of 9
(7,294 Views)

Hi mrsound,

 

usually LabView is very good at accessing arrays in For loops as it uses "auto-indexing". And even better: you can operate directly on arrays!

 

So you should ask for help on conversion of m-code to LV with some snippets from your code...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(7,282 Views)

hello,sir

I want to store values in an array from formula node whose have two inputs. those two inputs are numeric one. output is also numeric. but i want to store the output numeric values in an array.

Thanking you sir,

Best regards,

santhosh.

0 Kudos
Message 5 of 9
(4,829 Views)

Hi santosh,

 

what about loops with autoindexing tunnels didn't you understand?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(4,824 Views)

hello sir, i am not using any for loop sir... i am accessing even and odd elements from an array using while loop, at every loop even and odd values will vary according to while loop iteration and giving both as input to formula node. formula node has one output depending upon even and odd values so that output value changes accordingly, I want to store those values in an array because i have to do further analysis

Thanking you sir,

Yours truly,

santhosh

0 Kudos
Message 7 of 9
(4,816 Views)

So you already use a loop and only need an autoindexing output tunnel...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(4,806 Views)

I have forgotten that one sir....

Got the output!

 

Thank you sir, 

 

Best regards,

Santhosh

0 Kudos
Message 9 of 9
(4,795 Views)