03-21-2011 09:38 AM
I would like to input a few different arrays of the same length and constants into the formula node and output an array matching their length after some minor calculations. From another post I found out that I can just initialize the array as such:
float pp[100];
The problem with this is then I end up with an array much larger than what I need. What I would like to do is something like:
float pp[n];
where n is either the an input of an array size into the formula node or is something like:
n = sizeOfDim(td0,0); // I'm using a 1-D array here
Neither of these methods seem to work. How do I initialize my array "pp" such that it matches the 1-D array length of "td0"?
Solved! Go to Solution.
03-22-2011 04:00 PM
Check out this help file, it sounds like it describes what you want to do.
http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/arraymanipulationformulan/
03-22-2011 09:33 PM
Probably easiest to do your initialization externally. Create an input named pp and wire td0 into it as well. Now create an output with the same name pp and it will contain an array of the desired length. Of course this assumes you are going to change all elements in pp. Otherwise, just use intialize array to create a new array and feed in the length of td0, and whatever default value you want (ie. 0 or NaN). Untouched values will keep this value after the formula node.
03-23-2011 12:17 PM
Thank you very much. I knew there was probably some magical LabVIEW way to do this. That worked great. Goodbye Formula Express VI. Hello Formula Node.