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

Similar Messages

  • Problem with building array inside a case statement

    I have a problem with my build array.
    Iam trying to construct a build array when ever I see a new element in my parent array during run time.
    Using shift registers, search array and If- case structure, inside a while loop. Iam implementing this logic (I dont want to use Event structure).
    Iam able to achieve most part of it, but have a problem with the first element. Except the first element of my parrent array, every thing is appending in to the build array. Can any one look at my vi and suggest me what Iam doing wrong here.
    Thank you
    Attachments:
    debug.vi ‏12 KB

    I think you need to replace the tunnels (carrying the array) in the for loop with a shift register.
    Lynn

  • 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

  • Trying to clear an array of clusters with image info from memory - overflowing!

    I am using a cluster with IMAQ interface name, session info, image array, and individual image and creating an array of that cluster. I try to clear the cluster by deleting the array elements, read an array of images, save them, and repeat the loop. Over time, though the arrays are tearing through all available RAM. I tried removing local variables (which I understand would save a copy of the entire array to memory every loop iteration) and had no luck - actually the code hangs now on the write function, where it thinks there is no image data. I didn't think I changed anything other than to direct wire where there had been local vars to pass information from one part of the sequence to the next. Help! (screenshots of code attached).
    Attachments:
    framegrab sequence 1.jpg ‏8 KB
    framegrab sequence 1a.jpg ‏47 KB
    framegrab sequence 2 - grab and save.jpg ‏149 KB

    Hi, Nasgul,
    Not sure where you have resources leak - from your screenshots its not clear.
    But one is clear - you may not understand that IMAQ Images in LabVIEW passed by references. So, if you want to create array of images, then for each element IMAQ Create should be called with different name, otherwise all elements referred to the same image. For example, if IMAQ Dispose will be called for the first elementh of the array, then other 9 images will be automatically invalid.
    Compare two code snippets below:
    Common recipe for solving troubles with resources - reduce your application step by step by isolating parts of the code with case structures until application will be stable. Then you will found part of code which caused memory leak. 
    best regards,
    Andrey.

  • How can I append some data to an array via a case structure?

    Basically i want to do the following thing:
    do
    if control=0
    else
    Data=Data append data1
    end if
    }while(run=1)
    We try to avoid local variable since the size of Data is pretty big. I am pretty sure i can add a shift register in a loop structure.But is it possible to add a shift register in a case structure?
    Thank you!

    The best you will be able to do is going to be a variation on what CC suggested regarding replacing array sub-sets.
    If you do not know how big it will end up then over-allocate but still use the replace array subset.
    The delays you are seeing are due to the memory buffers groing and additional memory need allocated as the array grows. The Replace array subset function operates inplace and re-uses the buffer it is passed. There is no clear KB regarding which array operations operate inplace and which do not.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=74847&requireLogin=False
    Under Tools >>> Advanced >>> Show buffer allocations will show you where buffers are being allocated (LV 7.1).
    If you post a zip or llb of you code I am sure someone will have more to add.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • I have problems for to use Start function inside a case structure.

    I am doing data acquisition using the Config, Start and Read functions, all them inside a while loop. I want to use Config function only when certain conditions occur, so I put the function inside a case and no problem. But when I put the start function inside the same case, the acquisition is not good. Please view my attachment. My application is client-server type.
    Attachments:
    scope_server(config_start).vi ‏160 KB

    Boxer,
    I checked your example and have several easy but important suggestions for you:
    1.- First, make sure that the first time you initialize the VI, the AI Config and AI Start are executed, because based on the debug I made, your program doesn't do it, and this is very important.
    2.- Add an AI Clear after the acquisition is done, so that you release the resources. This is a good programming technique, and may help you solve your issue.
    3.- Add an Error Cluster, so that you know if an error occurred at some point of the acquisition. This will help you track the issue.
    4.- What do you mean by "the acquisition is not good". What does it happen? What does it do? Do you get an error? <- This is the reason of step 3.
    5.- Finally, if you have doubts
    programming AI, check one of the shipping examples of LV. They can give you a much clearer idea.
    Hope this helps,
    L Aguila
    Applications Engineeer
    National Instruments

  • Event structure inside a case structure

    Hi,
    I've got a problem w/ my porgram, and managed to boil it down to this
    simple example.  The program basically hangs if you change the
    Numeric value when the boolean is false.  I don't understand
    why.  I suspect it has to do with the way event structures are
    treated, but if someone cou please explain this I'd be greatful.
    Also, now imagine I have 7 numeric controls, handled by 7 cases in that
    event structure, and I actually want to do things in response to the
    value change for each.  Can someone suggest an elegant way to do
    that?  I thought what I had here was a good design, but apparently
    not.
    Bjorn
    (I'm using labview 7.1)
    Attachments:
    EventInCase.vi ‏24 KB

    It is generally a bad idea to place event structures into cases. Events structures need to be able to breathe.
    Maybe you can redesign your program and place the case structure inside the event structure, for example? (Also have a look at the online help for the event structure, especially the link "caveats and recommendations for using events ".)
    Detailed analysis:
    Your event case for the numeric is set to "lock front panel until event completes".  If you change the numeric while the case is false, the evet structure cannot execute, so the front panel locks forever. The observed behavior is as expected. All clear?
    In addition, if the case is false, the main loop spins at nearly infinite rate, consuming all available CPU. Place a small wait to be more cosiderate to everything else running on your rig.
    LabVIEW Champion . Do more with less code and in less time .

  • Red line inside of case structure?

    Easy question...why do I have a red line inside of my case structure?  When I run my code, it flashes and seems to pause it. Anyone know how I can remove this?
    Thanks!

    smercurio_fc wrote:
    And the point of all those local variables is... ????
    OH NO!!  It must be true!!  I must have turned to the dark side! 
    Of all people, how could I have missed all those Local abuses!! LOL!!
    Been looking at low level drivers all day..
    Good catch Saverio.
    Local abuse is when Local Variables are used when in fact they are not needed.  Local Variable buse leads to race conditions and unpredictable code execution.

  • 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

  • In the attached VI I dont understand why data from the inner case structures are not being transmitted to the array.

    In the attached VI I don't understand why data from the inner case structures are not being transmitted to the array.
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    TEMP.vi ‏25 KB

    It took me some time to figure what you are trying to do but I think I have it now.
    The SR is still required.
    What is happening is your "Bundle By Name" is replacing all of the fields of the cluster, not just the value coming out of the case structure. So to maintain the cluster stuff you do in earlier iterations you can either...
    1) Put the "Index array, Bundle by name, and Replace array" inside the case structure and ONLY bundle the value you are setting in that iteration. (as you will see Tim post shortly)
    OR
    2) Move the Index array before the Case, unbundle all of the fields and feed teh case structure and run them across the case so that ALL of your output tunnels come from the coresponding input tunnel EXCEPT for the filed you are trying to set.
    Ben
    Message Edited by Ben on 05-05-2010 01:31 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to implement index array inside case structure for searching a 3D array?

    Well I have a 3D array and I want to index certain elements from that array. And I have thought of one way of doing this is to have multiple index array functions on the block diagram to search the array simultaneously, but that would be messy. Or I could setup some kind of case structure and place each index array function into individual cases. I've tried the latter, but when I connect the 3D array to the case structure at the"?" it doesn't give me permission because it says I'm hooking up two different types of data. Case Structure is for T or F and 3D array is not a boolean.
    So how can I setup the Case Structure to work for a 3D array?

    A case structure's selection tunnel cannot accept an array.  What exactly are your search criteria?  It sounds like a few FOR loops will be needed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How do I get a case structure's panel?

    I am trying to place a boolean indicator within a case structure via LabVIEW scripting and am not having any luck.
    I started with the following source code, which creates and populates a case structure from an array:
    https://decibel.ni.com/content/docs/DOC-22703
    So my code, rather than put an enum inside each case, creates some compound arithmetic and a mask for each case.  This is all working fine.  I now want to place boolean indicators on the front panel that correspond to each case, and this is where my problem is.  I can create the indicators, but when I look at the block diagram view, all of the indicators are located outside of the case structure, rather than the indicators being inside of each respective case.
    I think the reason is that a boolean indicator is created by passing a reference to the front panel.  But the problem with this is that the VI panel reference does not indicate that the boolean should be placed inside the case structure, just on the panel, so when you view in block diagram mode, it's just thrown the indicators all outside the case structure and wired them up via tunnels.  I am getting the panel reference by accessing the OwningVI field of my CaseSel object.  I feel like there must be some field I should be able to access that indicates to put the block-diagram boolean inside of the respective case structure, but I can't find it.
    I've attached a file with 3 pics in it.  One shows a pic of the code I'm using to create the indicators.  One shows the type of output I'm looking for.  One shows the type of output I'm getting.
    Solved!
    Go to Solution.
    Attachments:
    lv_case_struct.jpg ‏221 KB

    Before you connect the wire to the terminal, call the Move method on the indicator's terminal and use one of the case structure's Diagrams[] as the owner. This will move the terminal into the structure.
    Try to take over the world!

  • Cluster value lost when leaving case structure

    Hello all,
    I am having an issue with a particular VI I am working on. (FYI this is in Labview 8.0)
    The VI is set up to run a current source, voltmeter, and thermometer and then record and graph data in various ways that are selectable by the user.
    Everything seems to be working fine except one particular graphing method. When I try to graph Current vs. Voltage, the current value is gettiing lost. Within a case structure the current and voltage are combined into a cluster and then exit the case structre to be later appended to a cluster array.
    However, the value of the cluster is being lost when the graph is set for Current vs. Voltage. Any other method and it is working properly.
    I can't seem to figure out why this is happening as it does not make much sense that the other methods of graphing work but this one doesn't when it is coded the exact same other than having different variables.
    I have attached the VI with added indicators showing that the cluster value is being lost once it exits the case structure. Any help would be much appreciated.
    Thank you very much and I apologize for my extremely messy VI.
    - Nathan Cernetic
    Solved!
    Go to Solution.
    Attachments:
    IV-RT.vi ‏185 KB

    You really need to boil this down to something we can run and reproduce the issue.
    Have you tried to break a few relevant connections and rewire? Maybe something is corrupt.
    Beside being a mess, your VI has quite a few glaring mistakes.
    Let's have a look at the structures in the upper right:
    90% of the code is the same in all three case structures, so all that needs to be inside the case structure is the small part where you built the 2D array. Everything else belongs outside the case.
    The sequence structure has no useful function.
    Why do you need to reverse the array with each iteration of the small FOR loop? Once before the loop would be enough. Right?
    Why do you use built array inside the small FOR loop, but don't autoindex at the loop boundary? All you ever get is an array with exactly one element, no matter how much the loop runs. Seems useless! (see below image for an alternative).
    You would not even need to reverse if you would use "built array" instead of "insert into array at position 0" in the central part.
    Others: You constantly hammer all your property nodes. The only need to be called when things change. Again, you have way too many instances. For example in the case structure where you are having problems, the same property nodes exist in all cases. A single instance of the property node belong outside the case and only the string constants inside each case. Whenever code is the same in all cases of a case structure, that code belongs outside!
    Message Edited by altenbach on 06-19-2009 03:39 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RubeLoopII.png ‏10 KB

  • Case Structure - multiple selectors, single exit

    I tried searching for an anwser to my question but I could not find one.
    I'm creating an interface for my graduation project (using LabVIEW 7.1) and I will be using several subpanel's, at this point I'm trying to create a selection method. During the design of the interface the users gave preference to buttons for switching between the different subpanels (there is a total of 4 buttons). And a subpanel is chosen based on a numeric value (I have taken the code from the viewer.vi example).
    Now I'm trying to work out some sort of case structure starting from the 4 buttons and resulting in a single numeric value. The idea being that when button 1 is pressed, subpanel 1 is active and every other panel is not. So far I haven't found a working one, especially because of the single numeric value I want to have.
    If the anwser is somewhere on this board then you have my apologies and I would appreciate a link to it.
    If something is not clear: feel free to ask questions.

    That's why a radio button control is better. It automatically allows only one button to be active. Clicking a new one will turn the others off.
    Try it! Just place any number of booleans (any style) inside the radio button control. The output will be a single number. If you wire it to a case structure, you'll get the control label for each as case name.
    (you can also allow or disallow "no selection", etc.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RadioButtons.vi ‏10 KB

  • 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 in pricing

    Hi everyone, We have a problem with the pricing and we need your help. We are working with SRM 5.5 with SP 13. We have an error that says "Incorrect status in pricing". This error appears when a PR is transferred to SRM and when we create a SC in SRM

  • CUE 8.6 help needed :(

    Dear all, We have got CUE module ISM -SRE-300-K9 installed on 2900 series router and Cisco Cll manager 9.x.The router is installed at Remote site and has a E1 Voice PRI for receing and making calls. we have got a license for IVR ports and want to con

  • TS3274 My screen has stopped rotating...how do I fix this?

    My screen has stopped rotating when Inchance the angle...how do I fix this?

  • Proper value of ship to party not geting picked up for a given sold toparty

    Hello, We have a   bdc program which passes data to the VA01 transaction. We are passing partner values like sold to party and ship to party using this program. However when we open our order, the value of ship to party is getting replaced by the val

  • Support of RedHat EL 5 for TREX 7.0

    Hi, Does anybody know when the RedHat EL 5 is expected to be supported for TREX 7.0? Thanks, Zareh Vazquez