LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shifting array's index down

Solved!
Go to solution
I fixed that and now it is running with case statements, now I need to figure out how to keep my values saved in the array
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 11 of 22
(1,199 Views)

Two important things.

 

1.  You need to wire the arrays you are maintaining on the shift registers through each any every event case or case of a case structure.  In your code, there are events where the array is unwired and the output tunnel of those cases is set to "Use default if unwired".  What happens if that case runs?  The array becomes its default which is an empty array.

 

2.  Don't put two event structures in the same while loop.  You should actually be able to get by with one event structure such as in Dennis' example.  Why doesn't yours work?  In order for an iteration of the loop to complete, all code inside of it must complete.  That means an event has to be fired on both event structures.  If you only hit the submit button in one, the other event structure is still waiting for an event to happen to it.

Message 12 of 22
(1,182 Views)
here is my code I am using:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 13 of 22
(1,172 Views)

Okay, so for some obscure reason, you decided to remove the event structure and use polling. While this is really bad style if you have the full version of LabVIEW, it works though you really should have a Wait(ms) in your loop. Silly to spin the loop that fast. The use of the local variables to initialize the loop does not make much sense either.

 

What else do you need? As I mentioned in my first post, it would be nice if you cleared the controls after the submit button was clicked and it would be nice to have some logic to prevent blank fields being entered. You mentioned difficulty saving the array values but you have not written any code to do that. Where do you want to save them? Text file, database, what?

Message 14 of 22
(1,167 Views)
I would actually like the values to be saved within the application.
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 15 of 22
(1,156 Views)
Saved where in the application, if not to a file?
0 Kudos
Message 16 of 22
(1,153 Views)
You've got the Make Current Values default method but this has some limitations. Better to save externally so that it will work if you ever build an executable.
0 Kudos
Message 17 of 22
(1,151 Views)
so I can not save this data within my application because that is a major part of this application.
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 18 of 22
(1,140 Views)
save to the list cluster.
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 19 of 22
(1,139 Views)

Harold Timmis wrote:
so I can not save this data within my application because that is a major part of this application.

No.  That would not be a good idea.  It would be like Microsoft Word saving your last document by modifying its .exe file so that your data would be there the next time you open word.

 

Your program needs 3 major steps. 

1.  Look for your data save file.  If it exists read the data from the file and put it in your shift register.  If it doesn't exist, leave the shift register empty.

2.  Your main part of your program like you have now.

3.  When you want the program to end, save the data in your shift register to your data save file.

 

Look in the example finder for numerous examples on file I/O.

Message 20 of 22
(1,137 Views)