03-25-2011 04:54 PM
Greetings,
I originally posted this question in the CVI forum, but was informed I might have better luck here.
First off I must say that I am new to the board and new to labview. I have spent over an hour searching for the answer to my question and have come up empty handed.
I have written a "test" as a sub-vi in LV, which will be one of many "tests" called by a test executive which my partner is writing in CVI. He has compiled my sub-vi into a dll, and it runs properly and without errors when all of the inputs are hard-coded as constants inside my sub-vi. Our next step is to have him pass me these same constants through his test executive...but.
I have all of the inputs to my sub-vi bundled into a cluster, some of which are arrays of singles. The problem is that when my partner compiles this into a dll, these arrays only have one member ( ex: MyArrayName[1]). What I want to do in LV is the equivalent of declaring my input array size like "Single MyArrayName[100];" in C, but I do not know how to do this.
Any help would be greatly appreciated.
Thanks for your time folks.
Solved! Go to Solution.
03-25-2011 05:14 PM
Arrays are not declared. Array size is adjusted dynamically. Simply put the amount of data that you want into an array. You may use the Initialize Array function.
03-26-2011 01:35 AM
Is this what you are looking for?
03-28-2011 01:59 AM
Hi, I posted some answer and documentation in the CVI forum here: hope it may help you.
03-29-2011 07:27 AM
Hi Substitute,
Pcardinale was correct in that arrays dynamically adjust themselves to fit the amount of data points that are input into them. If you want to pan through the arrays, to view a specific number (such as, if you want to see the 8th element on an array of 10), then you just go to your front panel and the first (0) value should be displayed as a number to the right of a scroll bar. Simply scroll up or down by clicking and the index number will change from 0-9 and reflect the value (on the right) of the element. I have created an example Vi in which I created 2 clusters of 2 arrays. You can pan through the clusters to see the values of the arrays and then pan through the arrays to see the values at each index. If you view the block diagram, I have created my arrays using a random number generator and a for-loop. Because I have generated a set number of points, creating an indicator from the for-loop automatically creates an array.
Please post back if you have anymore questions! I have saved the Vi in 2009 format in case you have an earlier version.
Jackie
03-29-2011 05:00 PM
Thanks much Mr. B.. Your help along with that of Kraken in the other thread exactly answered what I was looking for. It's great to know that this forum exists so that the Uber-Geeks can help us Knoobs out.
Thanks again,
SHM
05-17-2015 07:04 PM - edited 05-17-2015 07:05 PM
I know this is old but this is how I do it. to initialize to 0:
I extend the array until i get one that is faded. Copy it and then replace the content of the array with the faded element.
For specific size you extend and write giberish to the index you want it initialized and they all unfade.
05-17-2015 07:43 PM
@Foreshadow20 wrote:
I know this is old but this is how I do it. to initialize to 0:
I extend the array until i get one that is faded. Copy it and then replace the content of the array with the faded element.
For specific size you extend and write giberish to the index you want it initialized and they all unfade.
No, that's probably not the right way to do it!
A "faded element" is nothing special. To make an array diagram constant empty, just drag any element out and back in. The new array will be empty. Typically controls get the data from the user or subVI connector, so clearing it is typically not needed. There is an option to clear indicators when called, No code needed for that. either. There is also "right-click...data operation..empty array).
Typically writing gibberish creates an array containing gibberish, so why would anyone want to do that?
This thread is about "fixed sized arrays" and LabVIEW does ot have that datatype (except for LabVIEW FPGA). An array can be initialized at a fixed size and can be kept that way by usng only in-place operations. That is typically sufficient.