LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine Array

Solved!
Go to solution

I need help storing two different measurements into two different arrays. Both are within a state machine in the same case, and I need to place them into arrays so that I can use the two to get a linear fit. The two values are located in the "Calc" case of the state machine. The first is Meas 3 (Sample Average), and the second is ^T. I've tried simply initializing an array and then using the add to array option, but this results in only one value being stored to the array, as with every time through it makes a brand new one-value array, which is not what I need.

 

The two can be easily identified, as they are in the "Calc" case and each go into icons which display them on the front panel.

I feel like there is a simple solution to this that I am just missing, so any contributions are welcomed.

 

Attached is the VI, and thank you for all your help.

0 Kudos
Message 1 of 5
(3,640 Views)
Solution
Accepted by topic author gbaby

@gbaby wrote:

I need help storing two different measurements into two different arrays. Both are within a state machine in the same case, and I need to place them into arrays so that I can use the two to get a linear fit. The two values are located in the "Calc" case of the state machine. The first is Meas 3 (Sample Average), and the second is ^T. I've tried simply initializing an array and then using the add to array option, but this results in only one value being stored to the array, as with every time through it makes a brand new one-value array, which is not what I need.

 

The two can be easily identified, as they are in the "Calc" case and each go into icons which display them on the front panel.

I feel like there is a simple solution to this that I am just missing, so any contributions are welcomed.

 

Attached is the VI, and thank you for all your help.


Have 2 shift registers for the 2 arrays or 1 Shift register for a 2-D array. Use a build array terminal inside Calc to append elements each loop. In all the other cases, just pass the wire through it.


Kudos are the best way to say thanks 🙂
Message 2 of 5
(3,630 Views)

I don't see any arrays.  Were you trying to store them in a shift register?

 

What you really want to use is Build Array.  Make sure you are appending the new value to the 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 3 of 5
(3,626 Views)

I just wanted to say thanks, you two were able to steer me in the right direction. Now I can get stuck on something else!

0 Kudos
Message 4 of 5
(3,608 Views)

Hi,

 

Have a look on this state machine example

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 5 of 5
(3,570 Views)