LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with VI execution using event structure

Solved!
Go to solution

I got close with this subVI but it does not perform as expected. My logic was to 1st initialized arrays with sequence, then the event structure for many different cases. The object is to read in a 2D .cal file to 2 1D arrays. Cells can be manually changed by typing into the entry box then clicking the load button. Slider determines with cell in the index. Certain sequences of events work i.e.

1) Get cal file

2) move slider

3) type x entry box

4) load x value

 

Other sequences of events make the VI unresponsive, i.e.

1) type x entry box

2) load x value

 

Can some kind soul point me to the error of my ways?

 

Walt Donovan

 

Labview 8.5
Meas Studio 2008
Download All
0 Kudos
Message 1 of 4
(2,961 Views)
Solution
Accepted by topic author walter-donovan

First look only:

 

You need to wire the 1D arrays across ALL event cases, else they clear.

 

 

Message 2 of 4
(2,956 Views)

Thanks much. That was an easy solution and one that I missed while trying to debug. Does this code look at all reasonable? I have been studying and studying.... Many hours since I last asked a question on this forum. I have better insight on the workings of LV than last time but any guidance whatsoever is vastly appreciated. There are a few things about this VI that seemed odd to me but were the only way I knew to accomplish the desired tasks. 1) I used indicators, not controls for the two 1D arrays. Did this because it is necessary to load these arrays in full or part using three different methods - from file, manual entry, and the capture button which will poll an analog channel of the DAQ board.

Another thing that seemed strange was to build invisible dummy controls  to have indicators attached to the entry controls. I thought that it would be bad practise (maybe not work at all) having loose ended controls in an event case even though they didn't really cause a subsequent event to occur. They just took the number and waited for the "Load" button. Are these methods viable programming practise or just a half-witted way for this programmer to get a job done?

 

 

 

Labview 8.5
Meas Studio 2008
0 Kudos
Message 3 of 4
(2,946 Views)

A few more comments.

 

You are doing things way too complicated, here is a quick rewrite.

 

  • You don't need any of the hidden controls/indicators
  • You don't need any local variable
  • Write to spreadsheet file has a "transpose" built-in.
  • You only need to initialize one array, then branch it (better would probably be to use a single 2D array with two columns instead).
  • Your sequence frame serves no purpose
  • You don't need the timeout event
  • You don't need events that don't do anything. Controls retain their data for later use (Cell, enterX, enterY)
  • I cannot see any use for the hidden boolean, boolean2 indicators.
  • You can use "index array" to slice out the two columns (Array subset and reshape is way too convoluted)
  • ...

 

(Overall, I don't like the mechanics at all. Why can't you just use a 2D array control and enter data directly and leave out everything else?)

Message 4 of 4
(2,942 Views)