取消
显示结果 
搜索替代 
您的意思是: 

Indexing problem

已解决!
转到解答

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 项奖励
1 条消息(共 5 条)
2,874 次查看

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--
2 条消息(共 5 条)
2,863 次查看

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 项奖励
3 条消息(共 5 条)
2,861 次查看

@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 项奖励
4 条消息(共 5 条)
2,833 次查看
解答
已被主题作者 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.

5 条消息(共 5 条)
2,820 次查看