LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I initialize an empty array?

I am plotting an array of two cluster of arrays in an XY graph containing two plots. I have an array for each of the x and y components of both plots, and then another array of clusters. I am storing the x and y arrays in shift registers (four shift registers total) on a while loop. Inside the while loop, I have a case structure which appends new points to each of the four x and y arrays and plots them if the case selector is true, and then shifts the new array into the corresponding shift register. If the case selector is false, it shifts the old array back into the shift register (the shift register holds the same data as before). My problem is that I am loading an array containing one element, zero, into the shift register initially, which plots the point (0,0) on my graph. Is there any way to load my shift registers with an empty array and then append to it? I am very new to LabVIEW and would appreciate any help I can get.
 
Thank you,
 
Amanda
0 Kudos
Message 1 of 14
(48,816 Views)
Amanda,

Use the Initialize Array function with the size set to zero. Connect the result to the initialize terminal of your shift register.

Lynn
Message 2 of 14
(48,809 Views)
You're probably using a Build Array like this:

That gives you an array with a single element, zero. What you want is an empty array constant:

To get this, select the Array Constant from the Array palette and place it on your diagram. Then, from the Numeric palette select the numeric constant and drop it inside the array. Right-click on the element in the array constant and select Representation->(pick the correct numeric representation).


Message Edited by smercurio_fc on 07-08-2008 03:47 PM
Download All
Message 3 of 14
(48,805 Views)
Thank you both for your responses. I tried both methods, and I'm having the same problem with each of them. For some reason, when I replace the 'build array' function with either suggestion, the VI does not plot at all. It almost seems like the array size does not change when I use the 'append array' function, which means I'm probably leaving out a step. Any ideas or suggestions?
 
Amanda
Message 4 of 14
(48,797 Views)
Post your code.  It would be easier to figure out where the problem is.Smiley Wink
0 Kudos
Message 5 of 14
(48,795 Views)
It's very messy, so I'm not sure it will help! Sorry!
0 Kudos
Message 6 of 14
(48,790 Views)


apatt wrote:
. It almost seems like the array size does not change when I use the 'append array' function, which means I'm probably leaving out a step.
There is no "append array" function in LabVIEW. Is that something you made yourself?
 
Typically, you would use "built array".
0 Kudos
Message 7 of 14
(48,788 Views)
Sorry, I meant the "insert into array" function.
0 Kudos
Message 8 of 14
(48,777 Views)
You are trying to insert an element at position 1 of an empty array. (this is the second element)
That is not possible for obvious reasons. First you need to fill position 0! (the first element)
 
If you would use "built array" instead of "insert into array" you would not have this problem.


Message Edited by altenbach on 07-08-2008 02:39 PM
0 Kudos
Message 9 of 14
(48,784 Views)
I found the problem -- I had been messing with the 'index' input of the 'insert into array' functions earlier and I forgot to delete that part of the code. It works now. Thank you all very much for your help!
 
Amanda
0 Kudos
Message 10 of 14
(48,767 Views)