Case Structure Spaces

When you wire a string to a case structure it puts each state of the case in double quotes.  A comma is then used to have multiple values go to one case, and the ... (dot dot dot) is used as a span of values that go to one case.  My simple question that for some reason I was thinking about today is this:
Why does LabVIEW insert spaces at the start, and end of a case structure case?
I was doing some scripting and I got a 1D array of FrameNames.  I then did a Search 1D array but my program didn't work at first because I forgot to put the spaces and quotes in my search.  I understand the quotes, but why is the spaces needed?
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
Attachments:
Case Structure Spaces.vi ‏11 KB

My understanding is that this was done for readability in the selector and the FrameNames property simply blindly returns the strings (probably because whoever implemented it didn't notice the spaces or chose not to deal with them).
Try to take over the world!

Similar Messages

  • Trying to clear an array inside a case structure

    Good morning all.  I am trying (unsuccessfully, obviously) to clear an array inside a case structure.  (See case structure at right side of vi, I colored it green to make it easy to find).  Here's (briefly) what I'm trying to do.  I have 6 test probes in the process.  All six probes are connected to the Alcatel Detector through a 6-solenoid manifold.  As I run the test, I want to sample 1/second, for let's say 3 minutes.  For the first 30 seconds, I want to pull a sample from from probe 1, so I turn on solenoid one and leave it open for 30 seconds.  Now all 30 values are tagged as having come from Probe 1, and they're stored in array 1.  I can now compute an average value for probe 1. Then I close solenoid 1 and open solenoid 2, saving the next 30 values to array 2.  (and so-on, until I have measured all 6 probes for 30 seconds each).  Then I wait a pre-determined amount of time and repeat the process.  Here's my problem.  I want to clear out each array as I begin the second iteration, so that I can easily compute the average of the last 30 values.  If I initialize the array by connecting a constant 0 to the shift register on the for loop insid ethe case structure, it does not work, nor does it work to place the 0 outide the overall for loop (the next for loop going out, NOT the OVERALL for loop).  I know my programming skills are still crude, but I'm putting everything into this.  Anyone have any suggestions? 
    Attachments:
    HCMF rev 1 25 Apr.vi ‏485 KB

    Altenbach, I definately understand your approach, and I like it much better than my own.  But I still have no luck making it work.   I get the same result as before (my original attempt).  Value 0 of the array simply changes each iteration, with nothing "saved".  Each new value simply overwrites the last value.  Can you take a look at my new vi, with changes, and see if you can find the error of my ways.  I am but a rookie Jedi in the vast reaches of LabVIEW Space, and you are no doubt a Jedi MASTER
    Attachments:
    HCMF rev 1 25 Apr pm.vi ‏374 KB

  • Why does Labview insert quotations in the case structure selector box?

    I was building a case structure with an array of strings.  So, I copied the strings from the array on the FRONT PANEL directly into the SELECTOR LABEL.  My 3 strings have the form; to me, these are 5- character strings with spaces, or 7 characters if you count the spaces as string characters 
    A, B, C   
    A, B, D
    A, B, E
    So, when I copied and pasted them directly into the selector box A, B, C appeared as "A", "B", "C" and A, B, D appeared as "A", "B", "C" and then I got an error for selector values not unique.  Why didn't it appear as "A, B, C"?
    Why did it transform the string I pasted and insert the quotation marks?  I used no quotation marks in my array.  Does the selector label interpret commas as functional characters that require quotation marks??
    Thanks,
    Dave 

    dav2010 wrote:
    I was building a case structure with an array of strings.  So, I copied the strings from the array on the FRONT PANEL directly into the SELECTOR LABEL.  My 3 strings have the form; to me, these are 5- character strings with spaces, or 7 characters if you count the spaces as string characters 
    A, B, C   
    A, B, D
    A, B, E
    So, when I copied and pasted them directly into the selector box A, B, C appeared as "A", "B", "C" and A, B, D appeared as "A", "B", "C" and then I got an error for selector values not unique.  Why didn't it appear as "A, B, C"?
    Why did it transform the string I pasted and insert the quotation marks?  I used no quotation marks in my array.  Does the selector label interpret commas as functional characters that require quotation marks??
    Thanks,
    Dave 
    Actually in CASE STRUCTURE, any frame can have multiple values as 'Case Selector value' and these are separated by a comma. Also if you choose to operate a CASE STRUCTURE using string, it will automatically prefixs & suffixs quotes (") to that string.
    But you can enter  "A, B, C" manually and it will remain as it is. But if you copy and paste A, B, C, the CASE STRUCTURE will automatically change it to "A", "B", "C".
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Control does not stay in case structure while using motion VIs

    Hi,
    I have a motion control card PCI 7344 connected to my PC. I am able to control the motor at the required speed till the required position using an encoder. Now I have put my motion control VIs in a case structure in such a way that, if Case1 is selected then the motor should to position P at speed S, if case 2 is selected then the motor should move to position Q at speed S and if case3 is selected then the motor should to position R at speed S. I am selecting cases 1,2,3 etc. by scanning a set of numbers seperated by spaces which look like this,
    1 2 5 7 3
    This number scanning is done using a while loop. Now, when the first number is scanned in the above set of numbers. The number 1 is obtained and the control is switched to case1. But before the motor reaches position P, the control switches to case2 and before completing the execution, the program scans case5 and so on. That means that the control does not stay till the move in the case 1 is completed. I'm sure there must be a way to retain the control to a case and stop the next number to be scanned before the functions in the particular are completely executed. I thought of one method, i.e. by using the move complete VI provided in LabVIEW, but I could not implement it. Please help me out with this.
    Regards,
    Giridhar Rajan
    Automation Engineer,
    Cruiser Controls,
    Mumbai, India

    Hi,
    Our motion controllers allow you to preemptively start a move in the middle of a current move.  For example if you are moving from point A to B and based on some logic, you determine you need to immediately start moving to point C.  A preemptive move allows you to just load the new target position and call start.  You do NOT have to first stop the current move and then start the new move.
    In your case, you want the first move to complete before the second move starts.  There are two ways to handle this.  First, wait for the move to complete via a Wait For Move Complete function/VI call, or use the Check For Move Complete function/VI in a loop.  Second, use Blend Start instead of the regular start.  A Blend Start (if blend factor is set to 0) waits for the first move to complete before the second move starts. 
    Check out the help topics for Start Motion and Blend Motion to learn more.
    Thanks,
    Rodger S.

  • Can I put a READ function in a TRUE/FALSE case structure?

    Hi,
    I have a vi that operates as controller for a mechanical system of motors.  There are several sensors of various types, that provide input to the vi, including encoders, whose period is being measured.  The attached vi is the encoder period measuring part. It measures 15 periods and tells me the average of the 15 with each loop iteration.
    In my application, the encoder period measurement is not needed unless the vi knows that ALL THE OTHER sensors in the hardware configuration are measuring values within the desired range.  For example, Sensors A, B and C should all measure between 5-10.  If they are all showing values between 5-10, then, we want the encoder value to read and display.  If only one of the sensors, say A, is measuring 12, then, we don't want the period value to READ or be subsequently processed.  So, it is easy to set up the sensors A, B, C, to give a TRUE or FALSE based on whether they are within range or not, and if all 3 are TRUE, then, that value can easily be passed to the case structure that holds my READ function for the period.  Is this a good way to do this?  The goal is to eliminate unnecessary execution time that the period READ function would consume, as well as all subsequent calculations that are performed on the period value collected.  The period data is of no use if any one of the other sensors is not in the correct range.
    If any one of the other sensors is out of range, we want to skip the encoder READ step altogether.  So, it is easy to structure a BOOLEAN in my vi as shown in the attachment.  If I do it this way, will it throw an error, or just skip the READ until the BOOLEAN is true again?  Is there a better way to prevent the READ from happening if one of my other sensor values is not within the correct range?
    Thanks,
    Dave
    Solved!
    Go to Solution.
    Attachments:
    forum JUly 18.vi ‏26 KB

    Sure, you can put a Read inside a case structure. For your application, just check that your sensors are all within range (Comparisons palette), then AND the T/F's and use the result of that for your case structure. (If you are already doing the in-range check, I can't see it here because you have 5 subVIs that I cannot open here.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • How do I use a Case Structure with Strings?

    I need to use a string list to set up a set of cases to be performed. Is it possible to tell a single case structure to do "a, b, c, and d, but not e or f" or "do a, c, d, and f, but not b or e" etc... when you use a string containing the cases to be used?

    Blackavar,
    A case structure will only execute a single case at a time. If you want to have multiple cases execute in parallel, then you would need to have multiple copies of the case structure and split the string apart and wire them to all of the needed case structures.
    This could be done with reentrant subVIs to run truely in parallel. Anther method would be to have 6 different case structures, all with 7 cases each. The 7 cases would be "a", "b", "c", "d", "e", "f", and "0". Your input sting will need to be built up so that it will always be 6 characters long and then split up so that each character goes to one of the case structures. You would have your needed code for cases a - f. Case "0" would do nothing.
    Randy Hos
    kin
    Applications Engineer
    Nationsl Instruments
    http://www.ni.com/ask

  • Can I use a formula node to start the execution of a case structure?

    Hi,
    I am working on editing a VI to make it much easier to understand (for colleagues and non LV users). For one reason or another, the VI's creators did not fully make use of the power of case structures and other structure types. In the application we need it for, the instrument cycles and repeats measurements on several objects. We are interested in measuring the motor currents for several motors in the system. As it stands now, for each sample object's run, there is a separate sub-vi diagram which displays its waveform trace and several indicators such as max current, time at max, etc. That code was contained within a T/F case structure and copied and pasted 20 plus times.... Obviously the vi became extrememly cluttered and needed a huge screen to see. The trigger for the current case structures is an EQUALS comparison between one input (which is the sample object counter; and this part I will likely leave unchanged since it makes a lot of sense already) and a constant which was defined 1 through 20+ for case. 
    I have since made one case structure and 20+ instances of that case and have labeled them (at the top selection box near the detent arrows) "1", "2", 3, etc. I am wondering if I can use a formula node to act as the "trigger" which sets each case structure running? I believe that a simple IF statement should work. Please see a snippet of my attempt at making this in C below.
    For the node, I defined X as the input and Y as the output. The input to the node, X, is connected to the sample object counter. The output, Y, is connected to the case selector of the case structure. My attempt at the code is below:
    int32 y
    For(x == 1)
       y = "1";
     For(x == 2)
       y = "2";
    etc, etc.
    Is that above code snippet correct? Do i need something like "ENDIF" or "end if" at the end? Does "y" have to be defined as "int32" or can it be something else?
    Thanks for the help!

    Is your formula node doing anything else besides what is shown?
    Why don't you just wire the value that is going into it at X directly into the selector of the case structure?
    Attachments:
    Example_VI_BD.png ‏2 KB

  • How can I pass data generated in a SubVI inside a Case Structure out of the Case Structure?

    Hello,
    I am using a USB 2701 to control a heater.  I have three SubVIs that are all working properly on their own.  I'd like to use an Enum to select which of the SubVIs is running at a given time.  The problem is that no data is passing out of the case structure.  How can I pass the temperatures and heater outputs acquired by the SubVIs to the main VI?  I've attached my some of my code below.  I can't attach more than 3 files, but you can see how the main VI is configured.  Like I said, the SubVIs are working individually, so you shouldn't really need to look at them.
    Thank you,
    CJones581
    Attachments:
    RampHeater6-21-07.vi ‏305 KB
    69_Heater_Case.vi ‏23 KB
    HeaterTCD6-21-07.vi ‏210 KB

    CJones,
    You might check a couple of things.
    Your HeaterTCD... VI has a While loop with a stop button condition.  HeaterTCD pass out values only when it finishes running.  If it doesn't pop open the front panel (which usually doesn't happen when running a SubVI) you could run into a stuck loop because you don't have access to the Stop button.  This could appear in the form of no data being passed out (because the SubVI never stops running).  The primary VI opens the HeaterTCD VI, starts it, and waits for the VI to finish and pass final values .
    Secondary note: Unless you want your SubVI panel (which probably isn't open when running the main VI) to update continuously, consider moving your Temperature Graph and Temperature oC indicators outside the while loop.  Pass final values to them via a tunnel, since the main VI will only read their values after the loop finishes running, anyway.
    It might help to add error management to HeaterTCD like you have for RampHeater.  If you connect error lines with Error Outs to your main VI, that will help tell if there is an error somewhere that is preventing info output.
    RampHeater SubVI has the same issue with the stop button.  It is also probably getting stuck in the While loop waiting for a manual push of that SubVI's Stop button.
    An easy way to test this would be to set up a logic circuit so that when the While loop iteration counter reaches a certain number, it registers True and sends it to the conditional.  I know this isn't what you want to do long-term, but if that lets your SubVI return outputs it means that the SubVI was just never stopping.
    Hope that helps.
    David C, Applications Engineering
    David C
    Applications Engineering

  • How can I have multiple inputs into the selector terminal of a case structure

    Hi everyone
    I have a question on how to wire multiple inputs in to the selector terminal of a case structure. 
    Currently, I have three switches, each switch determines different case. So if I switch the switch 1 is on, the numeric indicator will show 1. If the switch 2 is on, the numeric indicator will show 2, so on and so forth. However, the selector terminal will not allow me to wire multiply inputs into the case structure, I tried Bundle by Name, Bundle and Array to Cluster, but they did not work. I set the case structure with 3 cases, they are 1, 2 and 3.
    Could someone help me please. I have attach an image and the VI of the work I did so far.
    I have another question, is there a function which can toggle other switches to off when there is a switch has been toggled on.
    Thank you very much
    Tommy
    Attachments:
    Trial - Case Structure.vi ‏7 KB

    Tommy, attached find a cheeseball way of doing this that has given me a LOT of mileage over the years.  IT lends itself nicely to a couple of really good practices that NI recommend, but I have given you the bare-bones to "see under the hood".  
    The recommended practices:
    1. You can make this a nice tight sub-vi where you can put it into a core library of routines that you'll use over the years, even extending the logic to look only for changes, etc.
    2.  If you are thinking about Front Panel design considerations, you'll want to use arrays of controls where possible, as that's a nice neat way of containerizing your switch for both the FP and Block Diagram.
    Have fun.  I have TONS of these types of things, so feel free to PM me if you have any other needs.
    Wes
    Wes Ramm, Cyth UK
    CLD, CPLI
    Attachments:
    Boolean Switch Logic.vi ‏11 KB

  • How do i output multiple arrays from a case structure to create one larger array

    I currently have a vi that has one hardware input that i needed to take a measurement then be moved and take a similar measurement at a different point.  To accomplish this i used a while loop inside a case structure.  The while loop takes the measurement  and finds the numbers i need while the case structure is changed per the new measurement location.  I want to take the data points i have created in each case and output them into a single table.  I assumed to do this the best way would be to get the data from each case into its own built array and build a larger array but I cant get the information out of the case structure so that it all inputs at different places.
    thanks for your help
    Attachments:
    Array.vi ‏30 KB

    Hi Ross,
    attached you will find a solution for your table building problem.
    I would suggest thinking about program design - having the same case content in several cases doesn't make sense. I also would not want my user to press several stop buttons depending on choosen measurement...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    Array.vi ‏45 KB

  • How can i use a string as a control for case structure?

    my vi is reading data. the output is a string,how can a string can control the case structure? because the there's a constructed vi in that case structure that wll perform a tast after the main vi read.
    Thank You
    (Can you please give me a simple example how can do this)

    Try this vi. You shouldn't have any problems just connecting a string to the case selector.
    BJD1613
    Lead Test Tools Development Engineer
    Philips Respironics
    Certified LV Architect / Instructor
    Attachments:
    string_to_control_case_structure.vi ‏10 KB

  • Run only once in case structure

    Hello,
    I have a menu set up that is wired to a case structure.  Of course the menu is some boolean buttons that are set to switch when pressed so the case will stay open as long as the button is true.
    inside that case I have another menu and a case structure that operates the same.  In one of these cases I have a piece of code that I only want to run once.  I have tried the while loop that runs once and a for loop that only runs once, but the section of code seems to run continuosly instead of just once.  It works ok if I use any of the latch functions but not the switch when pressed functions.  However, I need the button to stay pressed until the user is finished with that case.
    I really don't want to use an event structure as I was saving that for another piece of code that monitors inputs.
    Anyone have a suggestion?

    Typically, this works easiest with a shift register and and a boolean "implies" function.
    In the code example (see image), the button is set to "switch until released". (Of course you probably don't need the NOT, simply place your one-time code into the FALSE case )
    Message Edited by altenbach on 01-26-2007 01:52 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    implies.png ‏8 KB

  • How to get a case structure to execute only once in a loop

    I have a while loop that is monitoring temperature. Once the temperature meets or exceeds a given setpoint I want to start a timer. At this point I don't want to monitor the temperature anymore. That is, if the temperature should drop below the setpoint, I don't want to execute the case structure again when the temperture meets or exceeds the setpoint(the temp may oscillate about the setpoint for a given period of time). In any event, I need the case structure to execute only one time, not every iteration of the loop.

    You can put a local Boolean variable "Flag" inside that case structure and
    set "Flag" to False. Outside the case structure, use an "AND" function
    output to control the case structure. The "AND" function has two inputs. One
    goes to the comparison results between real temp and setpoint. The other
    inputs connects to the "Flag" variable. In this way, once you entered that
    case structure, the "Flag" will be turned to False, and then in next
    iteration, you won't get into the case again because the "AND" function will
    be False as your "Flag" is False now.
    Hope this helps.
    Rentian
    1. Inside the case structure, put a
    "BB Herman" wrote in message
    news:[email protected]..
    >I have a while loop that is monitori
    ng temperature. Once the
    > temperature meets or exceeds a given setpoint I want to start a timer.
    > At this point I don't want to monitor the temperature anymore. That
    > is, if the temperature should drop below the setpoint, I don't want to
    > execute the case structure again when the temperture meets or exceeds
    > the setpoint(the temp may oscillate about the setpoint for a given
    > period of time). In any event, I need the case structure to execute
    > only one time, not every iteration of the loop.

  • Possible to do this with case structure?

    Essentially I want the case structure to do: If case1 = run OR case2 = run, do this, else do case3++
    I'm using a string case structure right now, where for example, the inputs could be SWEEP_A or SWEEP_B but I want the case structure to use case SWEEPAorB. This is so I can have different names for the input string BUT run the same case (this is to avoid redundant code for what I'm doing).
    Thanks.

    For more complex logic use can use create a boolean array and convert it to a number.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How can I put a numeric indicator into a case structure using VI scripting

    I'm using VI scripting and I'm trying to add a numeric indicator inside a case structure.  I'm able to add the case structure and the numeric indicator just fine, but as soon as I specify the case structure as the "owner" of the numeric (as opposed to the block diagram being the owner) I get error 1060.  Is there any way around this?
    Note:  The reason I am doing this is because this specific pattern (indicator in a case structure) will prevent a VI from being inlined when it is being built.  This pattern will provide no functionality in itself, it only prevents the inlining.  It is added to a larger VI which is use to initialize objects in a simulation, and there are many of them in the total simulation.  If they are inlined, it takes a VERY long time to generate the C code, and performance on this VI isn't an issue since it is performed only once at the beginning of the simulation.  The rest of the VIs do need to be inlined for performance reasons.  Therefore, I'm open to other options to prevent a VIs from being inlined if the "indicator in a case structure" cannot be performed via scripting.
    If any of this is unclear please let me know and I can clarify.  Thanks.
    Solved!
    Go to Solution.

    I now understand what you were saying about inlining a subvi.  I did as you said and made a subvi with a case structure and an indicator within it.  I use the New VI Object node to add that subvi to the slow-inlining parent VI.  Then I tried to inline it using the invoke node, but I got error 1399, which make sense.  Is this what you meant for me to do, or did I misunderstand?
    Also, I tried the ControlTerminal reference approach you mentioned earlier.  Unfortunately when I called the move method on the control terminal property and had the 0th frame of the case structure as the owner I got error 1060 again.
    I really appreciate your help.  Do you have any other thoughts?

Maybe you are looking for

  • Error while running Site studio application

    For creating Site Studio application, I have followed the below tutorial http://docs.oracle.com/cd/E14571_01/doc.1111/e13650/ssxa_creatingsites.htm But while running the startSiteStudioDemo.jspx, I got the following error oracle.stellent.wcm.client.A

  • Web Service Error: java.sql.SQLException: Io exception: Broken pipe

    Hi, I am using JDeveloper PL/SQL web service generator. After some time we start receiving the "java.sql.SQLException: Io exception: Broken pipe" exception when we invoke the web service. I've noticed that the error starts occuring once all the conne

  • Creating online photo store using iweb

    I am a serious beginner. Trying to set up a web page where I can sell my digital photos. I was able to copy and paste the paypal html code and attach to a page however, it appears that if i want the individual photo to be purchased I will have to att

  • Using SUBMIT, EXPORT and IMPORT

    Dear All, I would like to know how to use these commands above to solve my reports issues... There are two reports created, one is a customized P/L report and another is Balance Sheet Report. In P/L report there a number of select-options of period a

  • Stroke styles

    In ID CS3 is there way to have more stroke styles then the standard offerings? I'd like to create a certificate type stroke border. Quark had this available. Is there a cheap or free plug in for this?