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: 

Problem adding values to an array with state machine architecture

Solved!
Go to solution

Hi,

 

I currently have a problem that I have build a program using the state machine architecture and now I want to add a value to an array every time a button is pressed, but I wish the array to add the new value rather than deleting the last value. I can't seem to figure out how to make this work without using the while loops and similar. It doesn't seem to work properly.

 

It is in the measurement Case.

 

The idea is I draw multiple lines and then it saves the length of the lines in an array and then I take an average of this so I can convert pixels to real life SI units. But right now I can't seem to add the information into the array.

 

There are quite a few Sub Vis but I think they shouldn't be important for this question thanks!

 

 

 

 

Download All
0 Kudos
Message 1 of 5
(2,464 Views)
Solution
Accepted by topic author Nanoparticles

What's wrong with just using Build Array?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(2,454 Views)

Also with build array the same thing happens, it enters the first value but when I run the event again it overwrites the entry already in the array rather than appending it to a new array field.

 

any ideas?

0 Kudos
Message 3 of 5
(2,445 Views)

hi

 

could you post the code in LV 2010?

 

are you clearing the array in any of the other cases? or are you deleting some elements from the array in other cases? i have not seen the code so cant think of any other options.

 

i am not sure if you have a 'use default if unwired' option enabled on this wire coming out of the event structure

Regards
Freelance_LV
TestAutomation Consultant
Message 4 of 5
(2,426 Views)

HI thanks for your reply, I actually have managed to figure out the problem, or rather I must have previously missed something hence why it didn't work. Thanks for all the help guys!

0 Kudos
Message 5 of 5
(2,405 Views)