LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting Array

Altenbach,

I have an array of these booleans that are used as on off reset states rather than on and off. As the program runs, random numbers are generating. I want to capture the time and number of each and initial number then save to a measurement file. I run the button through the cycle of on, off, reset. While the boolean text states "On", the state is idle so the numbers are not generating. While the boolean text states "Off", the state is on so the numbers are generating. While the boolean text states "Reset", the state is off so the numbers are not generating. I was trying to have the file write to file once the button state was "Off" and then reset the array to start over like a new test but the initial number does not reset. Any ideas?

Thank you for your help.

CLD Certified 2014
Download All
0 Kudos
Message 1 of 32
(3,080 Views)

Continued as a new thread from here.

 

As mentioned, I still don't understand the following. Maybe you can clarify...

 

I don't quite understand your program. Why are you growing the 2D array without bounds, thus thrashing the memory more and more, the longer the VI runs. Shouldn't there be an in-place solution?

 

When you reset, you seem to try to replace relevant columns with an empty array, basically leaving the existing column untouched. This does not overwrite anything.

 

Also, what is the purpose of the stacked sequential array operations in the subVI??? (They were al stacked on top of each other...)

 

 

Message 2 of 32
(3,065 Views)

The bounds for the 2D array is only 4 columns. I was unable to only have the number generate when the state is on, that is y there are the NaNs. I do not know what an in-place solution is but I will research it in the forums.

I do not know how to reset an array. I was thinking if I placed a constant array inplace of the existing array, it would reset it.

I removed some parts of the program but forgot to update the error handling.

 

CLD Certified 2014
0 Kudos
Message 3 of 32
(3,057 Views)

Yes, the bounds are four columns, but there are no bounds on the number of rows: Thus the number of elements is potentially infinite.

 

Place an indicator on the 2D array to see.

0 Kudos
Message 4 of 32
(3,050 Views)

I realize this. This is how the data is stored. Should the data write to file every time it reads and only show the current? Then how would I find the maximum random number for that test?

CLD Certified 2014
0 Kudos
Message 5 of 32
(3,045 Views)

Maybe it would be easier you you could simply explain what the VI should be doing in the various states. I assume that all four lines are independent, so simply explain it for one line.

 

For each of the three states, what should show on the various adjacent numeric indicators?

 

I'll have to look at it in detail later. My lpatop screen is not wide enough to efficiently navigate the oversized diagram. 😮

 

(Looking at the architecture, I would also recommend to do two loops. One for the UI (containing the event structure) and one to consume the queue. Currently the code is diffiult to maintain, because things are stacked so deeply. We need to constantly flip cases to find a certain code location. ;))

 

Message 6 of 32
(3,040 Views)

Yes, I agree that there should be two loops but I have never experienced a 2 loop design. This architecture acts like 2 loops.

CLD Certified 2014
0 Kudos
Message 7 of 32
(3,035 Views)

I tried to convert the one loop into 2. One for the GUI and the other for analysis. I was unable to link the time stamps together. I really am not sure where to go from here. I have never used 2 loops.

CLD Certified 2014
Download All
0 Kudos
Message 8 of 32
(2,998 Views)

I looked at your earlier code and I am still not sure what you are trying to do. Can you describe in a few sentences what should be displayed in the various indicators according to the state of the button.

 

Also, what is the purpose of the internal 2D arrays that grow forever?

0 Kudos
Message 9 of 32
(2,996 Views)

I am trying to create a vi that has 4 independent buttons. Each button has a cycle that the user runs it through [On, Off, Reset]. These cycles refer to three states [Idle, On, Off].

During the "Idle" state, the button's boolean text says "On" waiting for user action.

 

During the "On" state, the button's boolean text says "Off" waiting for user action. During the On state a random number and elapsed time are determined. Also, initial random number is determined.

 

During the "Off" state, the button's boolean text says "Reset" waiting for user action.

After "Reset" is pressed the data for that button is saved to a file and then the process can start over again.

 

This is the process for one button. I was trying to do it with more than 1 so I can run them simultaneously and independently of each other.

CLD Certified 2014
0 Kudos
Message 10 of 32
(2,986 Views)