From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure Selector


@ma.amanian wrote:

. However, I don't want my cases to be constants  


Case values must be constants.  You cannot have variable cases.  You cannot make a case selection based on a control itself.  You must use the value of the control.  Perhaps if you posted the code you have so far, someone could assist you better.

You explanation is still quite vague.  It seems as if you have numerical entries in your spreadsheet, and the first column is made into an array which is fed into a loop.  After indexing, you have a plain old number,  Is this not what you want to wire into the case selector?  I don't understand what you mean by the controls becoming case selector values.  A control has a value, it is not a value in itself.  Please post example code to make it more clear.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 16
(562 Views)

Just when I think I get you, something changes.

 

What I (think) I know.

You have a file with two columns.  One column contains a combination of 8 different numbers.  The second column is your data.  Whatever the 8 numbers represent, each file has a different set.  

 

What I thought I knew.

I thought you said you wanted an array separated by the value in the first column.  Now it seems you want to do something depending on which value you read in the first column.

 

Questions that remain.

What the heck are you trying to do?  

Inputting 8 numbers into 8 controls will get old fast, just saying.  (At least use a cluster for the controls, Cluster to Array is your friend).

Do you care what the 8 numbers actually are, or just which control the number matches?  For Example, you could have 8 tasks, which correspond to the 8 different numbers in the separate files.  The user then says Task 1 is this number, Task 2, etc.  If this is the case, use Search 1D Array.  When you read in a number from column 1, search for it in the Array of numbers corresponding to the control values.  Feed the index into a case structure.  Generate the eight cases (0-7) that correspond to the controls, and a default case for when the search fails.  On the other hand, if you want to do something different when Control 1 is 107 versus when it is 98, you are in for a long slog, and I would think a bit before proceeding.

0 Kudos
Message 12 of 16
(552 Views)

I just thought of something.  By saying that the control is an input to the case selector, I'm thinking that you want to do some action depending upon the latest control to have its value changed.  OK, 8 controls, call them C1 through C8.  If the user modifies the value of C1, you want to perform some action.  If the user modifies the value of C4, you want to perform some different action.  8 different actions for 8 different controls.  If this is correct, you cannot use a case structure to select the action.  You can use an event structure however.  Its like a case structure but its cases get selected dependent upon events, like changing the value of a control.  If this is what you want, let us know.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 16
(536 Views)

how to change the case selector value during the execution???

0 Kudos
Message 14 of 16
(407 Views)

@vidhya_1309 wrote:

how to change the case selector value during the execution???


Be patient and wait for the reply for your post. Did you see the data? No one will help you for this post. Please go through the Introduction about the forum

-----

The best solution is the one you find it by yourself
0 Kudos
Message 15 of 16
(406 Views)

Do you want to change just the selector value or the case values?  Could you describe what you're trying to do?

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 16 of 16
(365 Views)