From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Created Array

For a portion of a VI that I am building I want to have the user specify the size of a 1D array. The user will then populate the array with information from an Enum control. I want them to be able to move backward and forward in the array to edit or update information as needed, and I want the user to be able to add extra elements to the array after its been created. Anybody know how I could do this?

 

Thanks,

 

John

0 Kudos
Message 1 of 9
(2,675 Views)

All of this can be done with elements in the Array palette.  Sounds like a good place to use an Event structure also.  Lots of info in this forum and the help files on them.  We can answer more specific questions if you're able to post your code.


--Using LV8.2, 8.6, 2009, 2012--
0 Kudos
Message 2 of 9
(2,672 Views)

Taper,

 

This is a portion of the VI I am working on. Right now I have it set at the 10 Enum controls flowing into an array which is then used to make decisions later on. What I'd like to do is rather than having the ten set Enum controls of the front panel, I'd like to have just one Enum control that the user selects from multiple times where each selection is an new element in the array. I'm new to Labview, so any help is appreciated.

 

John

Download All
0 Kudos
Message 3 of 9
(2,663 Views)

I prefer using listboxes and menu rings for this sort of thing because they're much more user-friendly and look nicer. You can populate a run control from your enum's list of values, and the listbox can be re-ordered once you enable dragging. You can then create an array of values by reading the listbox's Item Names and converting that to your enum value. See attached for an example VI that could be converted to a popup dialog where you provide an initial list, and it returns the modified list (or the original, if cancelled).

0 Kudos
Message 4 of 9
(2,645 Views)

use a shift register to store your data, initialize it with a precondition "off".enter the data using a case statement to an array..can be done a multiple amount of ways?

 

Test[1].png

0 Kudos
Message 5 of 9
(2,642 Views)

Here is a piece of code that does basically what you want.

 

Array Button FP.PNG

 

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 9
(2,632 Views)

Hey everyone,

 

Thanks so much for taking the time to post these solutions I really appreciate it. There are some really nice looking codes here, unforutnatly I can't figure out how any of them work. While this is due to my own lack of knowledge/experience, and no fault of anyone else, it does mean I had to try and figure out something else on my own. I'm posting what I've been trying to do using intialize array, insert into array, and replace array subset becasue now I can't figure out why the array continues to remain the same size even after it runs thorugh the insert or replace functions. Ideas?

 

Thanks again,

 

John

Download All
0 Kudos
Message 7 of 9
(2,596 Views)

Nevermind, I replaced  insert into array with build array. Not totally sure what the difference is, but its working the way I want it to now.

0 Kudos
Message 8 of 9
(2,587 Views)

You may want to spend a little time looking at the example I posted. It uses the event structure which is the prefered method for handling UIs. Your is a polling system and will consume CPU cycles even when idle. Th eevent structure method will only run when a change has been detected. So, when it is idle the system is idle too.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 9 of 9
(2,581 Views)