LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing data from cases

Solved!
Go to solution

Hello labview experts

 

If i make a case structure with 3 different numbers, how do i store the data from each case? Look at my attached program. When i swap between the cases, the 2 "inactive" cases' value just goes to 0. How do i store the data from all cases at once?

0 Kudos
Message 1 of 6
(2,458 Views)

Hi Ignocia,

 


@Ignocia wrote:

How do i store the data from all cases at once?


There can be only one case selected (aka "active"), so you cannot handle "all cases at once"!

 

Generic answers/hints:

  • To store data in a loop for the next iteration you should use shift registers.
  • To keep the data unchanged you have to wire it across the cases…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,454 Views)

I understand that only one case can be active at a time. My question is - how do i store data from a case before i go to the next case? 

 

I've tried using shift registers, but i dont see them as a solution to my problem.

 

What do you mean by wiring data across the cases?

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

Hi Ignocia,

 


@Ignocia wrote:

I've tried using shift registers, but i dont see them as a solution to my problem.

What do you mean by wiring data across the cases?


Shift registers are the solution when your case structure is called multiple times in a loop!

"Wiring across the cases" means to wire all data through each case. Case structures also allow the "linked tunnels" feature to easily setup proper wire connections in ALL cases…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,443 Views)
Solution
Accepted by topic author Ignocia

You already have shift registers, so just wire across the case in all cases where you don't modify the data. You are good once all the output tunnels are solid colored. (i.e. no longer hollow!)

 

altenbach_1-1610473848154.png

 

 

Of course you have significant problems in general and I recommend to go back to the tutorials:

 

  1. There is no reason to have the string array constant inside the loop.
  2. Code that exists in all cases (e.g. the "dice") belongs outside the case. You only need one, not three!
  3. A matrix is a special datatype for linear algebra, so don't use that. Just use another "built array" to do 1D to 2D. This does not need to happen inside the loop.
  4. You might want to limit the integer input control to the valid range (0..2). Do you know how to do that?
  5. You probably want to initialize your shift registers. Do you know what that means?
  6. It might be easier to use a single shift register with an array of three elements and replace the correct position (see image below).
  7. It is a bad idea to write to file after the toplevel loop has finished. If anything goes wrong, the data is irreversibly lost. A state machine that can write to file on demand while the loop continues is safer.

 

altenbach_0-1610473466494.png

 

0 Kudos
Message 5 of 6
(2,414 Views)

Thanks for your response Altenbach

 

I know that it would work pulling the data outside the case. But i need it to be inside the case. I made a program that takes a lot of measurements automatically from 1 source (a DMM). So each case represents a specific test. I attached the program im talking about.

 

Wiring the switch registers in a loop for the inactive cases worked, thanks a lot!

 

I will look into some of the points you mentioned

0 Kudos
Message 6 of 6
(2,378 Views)