LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing problem

Solved!
Go to solution

I am running a state machine in a loop and want to log the errors that occur and diplay them on the fron panel. Since there are many caases and many possible errors i want to make sure all are displayed something like the following,

 

Gain coefficient error

Setpoint error

Response error

 

etc, but my problem is that the Errors array only displays one error and overrides it if another error occurs. I thought indexing would allow me to "stack" the errors so i see all the erros that occured during my test. The ""TRUE" case in the lower right case structure doesnt do anything with the CR. Any suggestions?...Would writing the errors to a file be easier?

 

errors.JPG

0 Kudos
Message 1 of 5
(2,223 Views)

You'll want to use a shift register on your outer while loop and concatenate your error strings together.  Your for loop has a constant of 1 wired to the iteration terminal, so it runs just once.  It won't keep adding to your array.  What you have is functionally equivalent to build array with one terminal.


--Using LV8.2, 8.6, 2009, 2012--
Message 2 of 5
(2,212 Views)

Absolutely silly way to create an array of errors. If you want to do this, add a shift register that is initialized with an empty string array. When an error occurs, add to the array with the build array function wired to the shift register. This would have to be done inside each state.

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

@Dennis_Knutson wrote:

Absolutely silly way to create an array of errors. If you want to do this, add a shift register that is initialized with an empty string array. When an error occurs, add to the array with the build array function wired to the shift register. This would have to be done inside each state.


Is this what you meant?..Its still showing only one error.

pic.JPG

0 Kudos
Message 4 of 5
(2,182 Views)
Solution
Accepted by topic author LM84

No, no, no. You have to pass in the array from the shift register. One input of the Build Array is wired to that and the other input is wired to the error.

 

Have you taken the LabVIEW tutorial or looked at any of the examples? An example that shows a case statement with a shift register and the build array is called 'Separate Array Values'. It's Listed under Fundamentals>Arrays and Clusters.

Message 5 of 5
(2,169 Views)