LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data processed in a while loop nested in a case structure

Hi,

 

I have the following structure: A while loop (call it WL_0) that runs indefinitely. Inside it there is a case structure (CS_1) waiting for instruction. When I hit the boolean buton (B1), the true case of CS_1 will start running a while loop (WL_1) which receives an array constant and adds data to it. After all data is added, WL_1 stops. My issue is: I need to save the data by hiting a boolean buton (B_2) linked to another case structure (CS_2) outside CS_1 and which has in its true case a Write to spreadsheet VI. However, B_1 returns to its False value when WL_1 stops running (i.e., after data acquisition), making CS_1 operate in its false case and I cannot get the data stored in its true case. 

 

The idea is sketched in figure below. I am using LabView 7.1. Please, can anyone help me? I thank you very much!

 

labview.png

0 Kudos
Message 1 of 6
(3,208 Views)

I don't really understand your question.

Boolean 1 will return to False if it happens to be a Latch mechanical action.  What is so wrong with that?  The 2nd case structure will execute once the first case structure, and the while loop inside of it ends.  That's what you say you want.  So where is the problem?

 

Why not actually code this up in LabVIEW instead of using MS paint to simulate a block diagram?

 

"My issue is: I need to save the data by hiting a boolean buton (B_2) linked to another case structure (CS_2) outside CS_1 and which has in its true case a Write to spreadsheet VI. However, B_1 returns to its False value when WL_1 stops running (i.e., after data acquisition), making CS_1 operate in its false case and I cannot get the data stored in its true case. "

 

Nothing sounds wrong with that, and dataflow will execute that order of operating.   Your sentence "making CS1 operate in its false case and I cannot get the data stored in its true case" does not make any sense to me.

0 Kudos
Message 2 of 6
(3,190 Views)

There probably should also be a shift register in the outer loop to carry the data between iteration of the outer loop. You can always add a case to clear it. Maybe you don't even need the inner loop if done right.

0 Kudos
Message 3 of 6
(3,174 Views)

Hi, RavensFan. The LabView is in the University where I study. I did that diagram at home. That is why I sketched it. But you're correct: I can save the VI latter as soon as I get in the laboratory again.

 

Yes. The Boolean butons are latched. In fact, I need them to be so because I need them to go back to default OFF state for each WL_0 iteration. The thing is: WL_1 will acquire measurement data only when I need (i.e., when I ask it to do by hitting B_1). But I need to save the acquired data after measurement, but don't want the save dialog to open automatically after the data acquisition. That is why I created the second case structure outside the first one.

 

The problem is that after data acquisition, the data is cleared in the next WL_0 iteration and then I cannot get it.

0 Kudos
Message 4 of 6
(3,137 Views)

Hi, Altenbach. I also thought about it. However, follow my idea: The CS_1 has to acquire data every time I hit B_1. But suppose I acquire a data once. The next time I will acquire the data, I need it to be totally new one, independent to the previously acquired data. If I put a shift register in WL_0, instead of acquiring new spreadsheet of data, I will be simply adding new data at the end of the previously acquired one.

0 Kudos
Message 5 of 6
(3,136 Views)

Write to spreadsheet file can append data to an existing file.  Look at its Context Help.

 

The case structure for saving data probably belongs inside the case structure.  You would never try to save data if you hadn't actually captured any.

 

Altenbach has already told you about shift registers which would allow you to hold onto existing data between iterations of while or for loops.

0 Kudos
Message 6 of 6
(3,127 Views)