Structure (2 cases)

Hello

Im a new user of labview.  Can anyone help me design a case where the structure if TI Gets a 0, let say the action takes place, and if it receives any other number, B action occurs?

In terms of code...

If x == 0,

A share

On the other

Action B

Hi saranam16,

This is an excerpt for 2012 SP1 (you can save the PNG on your computer and then drag and drop it on your block diagram into code).

If wire you your X value for the selector of case for the structure of the case, by default, you will have a case which is 0, and the other case it is 1. If you right-click the border of the 1 case, you can make this default case, which means that it will run when all other cases are not met.

To start using with LabVIEW, there are also a number of good resources here:http://www.ni.com/gettingstarted/labviewbasics/ and NOR offer of many training courses for users new to LabVIEW. If you have a SSP, training is available for free online.

Hope that helps!

Jeff Peacock

Product Support Engineer | LabVIEW R & D | National Instruments

Tags: NI Software

Similar Questions

  • structure of cases with a string as a selector of case

    Hello everyone!
    I have little problem with the structure of matter
    location:
    I created the structure of case and case selection is made by the chain.
    According to the selection of respected cases led should light up

    the structure of the case is as follows:

    case 1 [when the string is 'abc']

    {

    LED 1 = true

    LED 2 = false

    }

    case 2 [when the string is "pqr"]

    {

    LED 1 = false

    LED 2 = true

    }

    case3 [when the string is "', by default]

    {

    LED 1 = false

    LED 2 = false

    }

    now what is happening:
    I clicked on the "continuous run"

    now when I type one chain that nothing happens!

    my observation:
    When I type abc/pqr in the entrance of the channel, it actually flashes the led for a fraction of the time that I can't see, and the value in the default case.

    what I expect of this code!
    When I put "abc' the entry in the chain,"led 1"should be lights up and stays on until I put pqr in the input string
    even when I put pqr in the input string, 2 LEDs should be lights up and remains lit until I put abc in the input string.

    Thanks in advance!


  • Structure from case string "<------"-LabVIEW converts the string

    Hello

    I want to parse the string lines read from a data file.  Some chains start with the characters ".<\".  when="" i="" enter="" this="" kind="" of="" string="" as="" a="" case="" in="" a="" case="" structure="" the="" string="" is="" being="">

    For example, I'm going home. "<\C" (upper-case="" c)="" as="" my="" case="" string,="" it="" changes="" to=""><\f".  if="" i="" enter=""><\c" (lower-case="" c)="" as="" the="" string="" it="" becomes="">

    I am currently using LabVIEW 2012.

    Any ideas what's happening?

    Thank you

    Ian

    Some ASCII characters are nonprinting control characters (less than 32 values). These are sometimes encoded using the backslash code and it seems that is what makes the structure of matter - when you type \C, the structure of the performer as "oh, you want the value 0x0C ASCII, which in the code for backslash is represented" as \f (means 'form feed). "When this is the case, you typically use one-to represent the------characters, so you really need set the structure to match on.<>

  • Calculate the maximum value of the sub-table when creating using a structure of case and records the shift

    I have two 1 d arrays that contain cyclical information (a bit like a sine wave).  One that contains information about the position in degrees and another that contains the couple.  I would like to calculate the value of maximum torque whenever the station is within a certain range (for example, 30 to 80 degrees).  The beaches are repeated - that is why it is cyclical.   I use the function "in the range", a structure of the case and the shift records to build a new table with the values that are included in the beach I said - that was easy part (see attached VI).  I'm struggling with a way to calculate a maximum value for each sub-table formed when the values are 'in range '.   Your help is very appreciated.

    vt92 solution worked!  I agree that there should be a simpler solution, but your to works fine.  Thank you very much.

  • Is a global functional with loops inside the structure of cases subject to the race condition?

    Like this one:

    Global variables funtional implement Mutual Exclusion for their confined i.e. code section of the code in the FGV cannot run once at the time by all processes with competing concurrent access. With this in mind, all the code inside will be executed while one task has access, then released once the FGV has completed the operation. The structures listed as your curls and case Structures are not in themselves share resources, so there is no problem with conditions of competition in this area.

    You would only if worry if the functional Global Variable wrote to other resources shared in a way that is not properly synchronized.

  • event structure vs case structure

    I am developing LabVIEW: tool of control and vision. Front Panel has a lot of buttons, each button will execute a single or a group of the screws.

    I found that:

    1. event structure is good for digital change. i.e. the user change a corordinate and motors are moved.

    2. the structure cases is suitbale where such that use click "run MTF", a case structure is executed to calculate MTF.

    I tried to use the structured event to pick up button click but it isn't reliable workign, such as the user clicks too quickly and LabVIEW does not record events or LabVIEW records the event even twice

    However, I have a number of clicks functional structures. My block diagram will be uncontrollable.

    Any idea/tip/trick be greatly appreciate!

    -best

    If you understand how LabVIEW works and understand the principle of data flow, what I'm going to say the will of sense.

    The idea of a Structure of the event, it's that he's sitting there, don't take no time CPU until an event (usually a change in a Front Panel control) takes place.  Then he does everything you ask in its event arguments.  The trick is to do almost nothing in the structure of the event, but to say another loop, running in parallel, to do something.

    The key here idea is you have two loops, running in parallel, independently, at their own pace.  One, the event loop, waiting for an 'event '.  When it happens it it "sends a message" to another loop (or loops) that make treatment (which may take some time) as defined by the event loop.  The point is that it is very fast to send him the message (which is usually done via a queue), so the event loop is able to respond much more quickly that the user can push buttons on a façade.

    However, when the hands of loop event off the Message 'go do this task' another loop, the task may take longer.  If the tasks are put in a queue and then they get finished, the next task is running.  The key thing here is that the two loops, the loop «Ask» (events) and the loop ' Do ', run indepedently and at their own speed, nor dependent on the other.

    Bob Schor

  • Structure of cases with String in hexadecimal display

    Hello

    I uses a case structure to decide what to do after getting the answer to a device. The device back is the hexagonal shape string, for example "0250 3F30 0D ' (without the quotes)." The 02 is the , and D 0 is thein the ascii table. The return of all read P? 0. I copied the 3F30 ' 0250 0 of the label selector box but it didn't work. How do I do?

    Thank you

    Ryan

    Replace '-' view of the Code and that stick the label on the box. I don't think there is a way to use the spell.

  • Structure of case based on a parameter

    Hello world!

    So I was wondering if we could set up a business in a structure of the case, which is based on a parameter.

    So here's what I mean:

    I have a case structure inside a loop for (i = 0,..., N-1). I would like to deal structure for 3 cases: by default, I = 0 and i = N-1.

    The problem is that N can change from time to time. It is not a fixed value.

    Therefore, is it possible to create something that is literally "N - 1"?

    Thanks in advance!

    Valentine

    N °

    But why you couldn't put the N in the equation that determines which cases to run.  You do the calculations and comparisons in the code to the terminal of selector.

  • Structure of cases only the execution of a case

    (Again), I'm trying to control steps ThorLab, LTS300 and MTS50-Z8. I wrote the attached program for this. The program essentially starts communication with stadiums, made a few moves with them, then disconnects them. I have asked me to include a button 'CANCEL' or 'STOP IMMEDIATELY', just in case where something goes wrong with the stages, that termiantes of the communication with the stages immediately. Stop key immediately in the vi below done stop the program when you press on, however, I was expecting the program to run the routine of movement when the button has not yet been activated. But nothing happens. Could someone explain to me where I'm wrong. I've also included images of the case of true/false for the button and the sous-schemas that should trigger the button. I'm afraid that it is very simple...
    Thanks in advance

    bockdoug wrote:

    Makes no sense to me!

    Rules of data flow:

    1. no code can run until it has all its entries

    2. no code will display anything up is finished running

    3. a loop cannot go through all that she has not completed running

    So what happens is you have an addiction to data between the loop and the structure of the case.  The structure of the case cannot run until it has an entry in the loop.  But the loop will not release its value up is finished running.  And the only way to stop this loop (and authorize his release must be sent) when the termination of the loop is set to TRUE.

  • Loops For parallel within a Structure of case - one or more threads?

    I wonder if I put parallel for loops within a structure of business will be to the loops have their own thread, or run in the same thread?

    I think it would be a thread, but then I saw this post when looking on the forums to check.  Alas, I ask directly.

    I created the parallel for loops to improve the performance. (I'm in BT 8.5, if do not have the option of clever parallelization by right-clicking the loop for).   The parallel loops have the same code in each (I know I do the reentrant subVIs).  I wanted to put a case around the loop structure, so that they do not run if there is a mistake in them (I have a master/slave updated structure the where the for loops are slaves) because the code inside the for loops is 1) depends on correct data of the master and 2) by the high-performance computing I want to skip execution of loops if the master has a stop command.  Otherwise, errors are likely to be generated in the slaves because of incorrect data by the captain or the judgment happens quickly, which can confuse the user.

    Let me know if you need more details.  Thank you!

    ~ Kristen

    Each loop will run on its own thread and they will work in parallel. The only downside would be if they call them both the same Subvi and the Subvi is not reentrant. Besides, any shared call which blocks will result in two loops is not able to run completely independently.

  • structure changing case label

    I have a structure case I want to change the name to and remove a.  I did it on the case structure pane and the new name became red.  This is probably due to the enum connected to the switch case has still all old enum labels.

    I tried to change the enum, but it does not allow me to change the name of the enum and will not remove the case structure that I deleted.

    How can I get the enum that is connected to the switch case structure to match the business structures?

    I thought about it, I changed the type definition and changes took.

    Sorry to waste your time.

  • How to present respectively in a structure of case, a certain percentage of the iterations

    I schedule a task to be used in a psychology experiment. There are two options for the stimulus, the test and captures stimuli. I would like to introduce the stimulus test on 90% of trials and the stimulus of catches on 10 percent of the tests. Currently, I have the test and catch the stimulus as two cases in a case structure and I this case structure in a loop so I can control the number of trials. I can't understand how the stimulus test run on 90% of the iterations.

    Ignoring all the functions for randomizing data that exist probably in BT, here are some options:

    1. The "sort of" one - not sure how many iterations you will have and you want to choose between two options at a probability of 10% and 90%. Take the random number generator and check if the result is greater than 0.9. It will be 10% of the time (at least close enough to something involving human interaction, which probably has a limited number of tracks).
    2. You know how many iterations you and you want an exact COMP - generate an array of Booleans of size N initialized to f. divide N by 10 to get your 10% and then use a shift register to replace specific table elements. You replace the elements must be a random number multiplied by N and rounded and you must also have a while loop in the loop for to regenerate a number if there is one, you have already chosen.
  • "Structure of case: no case for some values of selector" error

    Hi all

    I'm new to LabVIEW and get an error that I can't get rid of. My code is made up of a state machine with 5 different States. I don't know if this is a common mistake or if I need to provide more information. Please let me know and please help.

    Best regards

    L.E.

    This is explained in the help of LabVIEW: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/specify_default_case/

    You drive the structure of the case of an enum. If you connect an enum, you must provide a case for each enum value or specify a case as in the case of failure to perform if no case matches the value of the enumeration.

    -Or-

    You drive the structure in the event of a string or numeric and do not have a case specified as the default case if no case matches the value in the alphanumeric string.

  • limitation of the same structure add cases

    Hello

    Can I know any excretion have the same structure add event .bcase if I use more than 50 events in strucute even.

    I posted on the forums about the recording of the change in value on multiple controls here and here.

    There is no real problem having lots of event, but it takes a lot of time for each of them create then because I'm lazy, I'm trying to find ways to accelerate my LabVIEW programming - if you have a lot of events that do the same thing, so you can save time by having a single piece of code manage events.

  • Question of trivial case structure

    I am using a chain with a structure of case control.

    According to the string value, I want the VI to show some sort of an indicator on the front panel.

    If the value is 00 I want to show him "Local."

    If the value is 10 I want to show him 'Off '.

    If the value is 12 I want to show him "Remote".

    Sorry I'm new to LabVIEW and I can't quite wrap my head around this

    That matches the entry' is a string containing '00' '10' or '12 '?

    And the output is a string containing a 'Local' 'Off' or 'Remote '?

    So your case should be '00' '10' and '12 '.  In each case would be constant string with the respective 'Local' 'Off' or 'Remote' words this thread out of the structure of matter in a tunnel to your string indicator.

    Have you taken to the LabVIEW tutorials online?
    LabVIEW Introduction course - 3 hours
    LabVIEW Introduction course - 6 hours

Maybe you are looking for