Conditional looping

Hi all

I have a .dat file that contains n number of channels.

That I owe some operations such as filtering, deleting some initial in the channels data until it reaches the value 0(pre data) and delete some data, after hitting 80(post data) with each channel. And trace all channels of exixting on report

But the number of channels is not always constant. Some time, it may be 3, sometimes perhaps 10 and even 15. This makes myscript to change each time, depending on the number of channels.

So I thought to use

L1 = Globusedchn
msgBox globusedchn
L2 = 2
until L2<>

"Filter for each channel with the help of CFC 180 with x - axia as weather channel

Loop

How can I improve my code to accomplish my task. Hope this is clear ;-)

Thanks in advance

Rsh

Hi, RSH,.

Please see the script that I have attached to my previous post which avoids this problem.  If you create a group for all channels limit, then it is easy to refer to these channels limit regardless of the number of channels of data loaded from your data file - that is the whole point.  You don't want to use the (5) or (6) syntax for limit channels.

Brad Turpin

Tiara Product Support Engineer

National Instrumetns

Tags: NI Software

Similar Questions

  • / Start differed only in a conditional loop.

    Hello

    I want to use a delay (or some kind of timer) in my program. I intend to use for it in a conditional loop. Specifically, if a certain condition is true, then I want to wait for 50ms and then check out some other condition, which, if true, I want to stop my program.

    I used wait vi in the calendar section. But this vi stops my entire program. Specifically, when the above condition is met, I want the late vi to run along with my acquistion of data vi. At present, when the late vi runs, any (acquisition of data, detection of crete, pointing etc.) in program breaks. I guess its correct functionality to wait vi, but it does not fit my need.

    Do you need an alternate suspension loop condition (self-timer) an individual without affecting the other parts of my program? Specifically, only delays in parole for awhile then loop than other features as for the acquisition of data, detection of crete, pointing etc excute normally.

    This is because the timer of waiting (ms) contains the code to wait too long before continue execution.

    You want to use is the Express VI of elapsed time.  It stores the time in a shift register and returns a true that after the specified time interval has elapsed, it doensn can't say anyting to Wait.  Make sure you read the help about it.  It has multiple inputs such as Reset and Auto-Reset, you'll want to pay attention to, if it is a function that you need to run a series of measures of elapsed time.

  • Conditional loop does not work correctly.

    Hello

    If you look at my code, its all about the analysis of a dictionary. IM check the dictionary for the word 'aardvark '. It gives me wrong all the time. When "aardvark" is the first word of the table, IE my_dictionary [0] is "aardvark". I wonder why the conditional loop does not work very well. IM checking if the user string aardvark is == my_dictionary ; he should give me the true value.

    Is there an error in the code? Can someone explain to me where im going wrong?

    PS-> put everywhere traces gives me the right output. Except for the result of the if() function.

    Best regards and many thanks in advance.
    Roshan Kolar

    Hi Raymond,

    Thanks for the reply. I had the problem, actually the conditional loop was perfect, the analysis was not. The reason is, a few words in the dictionary had a return of cart/jump of line/space to the index of the last after the word. It was randomly, so some words have been taken, but some were not as "vicious" == "vicious" - gives the INVALID WORD.

    So I was thinking about the parser, where I removed the unwanted last tank - now the condition has worked well. Thank God I worked even after the publication of the request.

    Thank you very much Raymond.

    Kind regards
    Roshan

  • Conditional loop

    Hello

    I thought it was a simple conditional loop to search for every occurrence of a string of serach in a variable. Basically by train to find the occurrence, he notes, then go. If findnocase isn't an accident, it should return 0, to end the loop:

    < cfset findvar = 1 >

    < Cfloop condition = "findvar GT 0" >
    < cfoutput >
    < cfset findvar = #findnocase("#form.searchterm#","#searchfile#",#findvar#) # >
    Position in the file: #findvar # < br >

    < / cfoutput >
    < / cfloop >

    This does not at all. Everything rotates forever and never returns a result.

    ... help? Thank you!



    Position in the file: #findvar #

  • Conditional looping. How to check the previous result s of closure?

    Hello

    I would like to repeat a sequence for the second time if the sequence is not the first time. To do this, I would use the loopback step properties feature. Question: How can I build the loop State Expression referring to the step of Staus (pass/fail) of the first loop?

    In loopback loop Type properties, select number of pass/fail.  Then assign the stop after 1 and iterations to pass.  You can set the maximum number of iterations to any value you want (in your case, it sounds like 2).  You can play with the numbers to fit your scenario.  As you play with the numbers, you'll see the values of the changing expressions.

    I could give you a better answer if I understand exactly what you wanted but it will probably do what you want.

  • Conditional loop expire

    I am trying to eliminate a datediff calcualtion weekends. INCIDENT_RESOLVED is when a problem has been resolved in pir_date is the date held a meeting to discuss the problem. We want to see how much PIR_DATE are the INCIDENT_RESOLVED 48-hours. Person in Saturdays and Sundays, so it would be wrong to include these days in the total time between the resolution of incidents and the PIR. I came with the bit next to the code to set a variable to the date of the incident, and then add a day until the variable is equal to the Date of the PIR. If the part of the new variable is 1 or 7 (Sunday or Saturday) I subrtacting 24 the difference previously calculated between dates. That's what I want to do. I get an error of time-out on the loop. Any suggestions?

    Thank you

    John

    Thank you Dan, but I eventually make it work myself with a loop. Here is that same piece of code with the correct loop. I ended up actually simplify and it worked.

  • Rename items when a conditional loop

    Hello guys,.
    I have a text in the database I get in the PivotTable
    using Oracle BI 11 g Publisher. I'm not good with XML and
    I can't find a code that checks if the text appears and rename
    It accordingly.

    I guess that the State would need to come in this area:

    <?-foreach: $c60734 / / R1? >


    or in the <? / H ? > next to him?

    Thank you

    Why not replace function:

  • timestamp as conditions for loops

    Hi, I'm new to LabVIEW. I'm looking for help with my vi, which has some time a loop for waveforms (currently of a simulator) written in a text file. I want to run the conditional loop according to timestamps. I have the timestamp for the start time and the end time and the current time on my front and I wish for my time loop to run continuously until the present time = off time. I'm having a hard time finding an example of code for this operation (simple?), and I would really appreciate help. In the end, I want info stamp time to incorporate in my data file but not the priority now. As you can see my code is a mess right now.

    Use a timer past. Subtract the start time of the end time and the result of wire to the goal time of the timer has elapsed. The timer has elapsed will be in your loop. Boolean 'Elapsed time?' thread to your conditional control of the loop.

  • How to end parallel while loops

    Hi, I'm using LV8.5.  I have 2 while loops, running in parallel.  Loop1 is faster (waiting time of 100 ms) and Loop2 is slower (several minutes waiting time).  I use a local variable (STOP button) Boolean to commonality between the loops.  The button is in the loop faster (Loop1) and the local variable is in Loop2.  When I try to end the While loop, Loop1 stops immediately, while I have to wait for Loop2 finish.  Is there a simple way to make two loops to stop immediately?  I have been using a Control\Stop Application, but may not be the right solution.

    Thank you.

    Hi shanx2,

    reduce waiting time in your second loop and count the iterations instead. The loop will do the same, but the stop will react much faster. Another possibility would be to use a queue instead. Connect to a timeout that corresponds to the current time-out period, you use and send a message to stop the loop. You can choose between the queue has been exceeded or not. Connect this result to the conditional loop. You can send the message from the queue after the first loop was arrested.

    Mike

  • run a while loop in separate vi, minimize the window flashing

    My apologies in advance for not including a VI; I cannot give it, cannot even provide screenshots.

    I have a state machine base with a cluster of Boolean values that are analyzed in the 'default' State, the scan index = true determining the next State. All other States to return to the default state. The State of 'stop' stop the loop with a Boolean constant = True, located inside the structure case wired to the time entry conditional loop (all States have a Boolean constant False wired to it). Apart from the cases

    statement, the wire connected to the conditional entry is connected to a Boolean indicator, ' Stop, in really. The time delay within the State of the machine while loop is currently set at 100 ms.

    In addition to the 'State' shift register, the state machine has a "boolean" shift register. All States, except one, feeds the value passed the Boolean value through to the next State (i.e. wired directly from left to right the structure of the case). The exception is the State which inverts the Boolean value, with the output of the inverter transferred to the State following and also connected to a Boolean flag, 'Show the State', the

    indicator outside the case statement but inside the while loop. All other States wire just the previous state of the Boolean value through the following State, unchanged.

    In addition to the State of the machine while loop, I have a parallel while loop (scourge of the LV forums). All entered conditional loop is connected to a local variable to 'stop, really. " A True/False case in this while loop structure contains a Subvi in the case of True value. The Boolean value of entry to the case statement is connected to a local variable for 'Show status'. The Subvi, which is in the real case is to display the State of the

    user.

    The Subvi which provides status through its frontage runs a script in python via a 'comand prompt"vi. The necessary update to the python command send is ~ 1/second. Within the Sub - VI is a 1 second delay time after execution of the code.

    It works but I'm doing some improvements with minimal impact on what I have.

    Two cases of VI properties that relate to the conduct of the State Subvi (floating or default, modal does not at all):

    1. with "Firm when previously closed" selected, the window switches VI (via the main switch VI) open and closed but when it is open there is the a second window flash that could cause seizures in some users.

    2. with "closes when previously closed" deselected, the window remains open and it is difficult to tell the difference between the running state and is not running. In addition, the Subvi window will not be reduced for this option.

    Is there a little invasive change, I have the code in force to stop a second flash described in #1 above and activate / deactivate the Subvi status window?

    Thank you

    Jeff


  • To find the slope to a section of waveform data

    I'm a newb labview is currently working on a program that controls the movement of a cylinder of air through valves and solenoid valves and collects / process generated data. He seems to have understood most of the messages in the forums by reading and watching various example problems but I'm faced with a section of the processesing of data.

    Is attached a screenshot that contains the Panel before the VI with a sample of typical data, the schema-block VI main concern and the block diagram of the sub section vi that I fight with. If you look at the data, the blue line is the voltage signal in a pot in the cylinder which gives me the position, the red trace is a reading of a load cell and green is a continuinty measure that indicates when the elements I'm pulling was separated.

    I want to be able to do in the processesing data is to determine that the slope of the blue line (the speed of the cylinder) to the instantaneous continuity is lost along with the maximum value of the reading load cell in a window at this time. I have a DAQmx task configured to trigger a signal of 1 in rising edge on the cylinder and collect a sample over 250 points to 5 kHz. The daqmx read in the loop is set up to take a sample waveform when it is available and survey it. The second loop is configured for deque this table of 3 waveforms and post it on a chart, process the data and write the data to a text file.

    One of the things I noticed in testing this VI is that data seem to be in a unique dequed of data point at a time (or plotted at least that it is), but I was under the impression that the entire waveform must be dequed as a single item? Regarding the data sub vi process, it seemed to work wthen I was testing a simplified version of this without the wave of search function so I suspect that my problem could be with it. I would really appreciate any comments that you guys could provide. Thank you!

    P.S. Please excuse the way I really hokey, the while conditional loop set up, I hope to have something a little more elaborate before you deploy the code.

    daBub,

    Use the threshold 1 d Array function rather than the search function.  That's what I get to generate a response without looking things up.  The threshold D table 1 is the first place where eon element is less than the threshold and the next element is above it.  That's why you have to reverse the table since you are looking for a falling edge.

    Lynn

  • Relay switching

    DUT is followed. Power is given through relay. The current control system is taking to this time delay relay is on. If the current increases up to a certain level relay must off the coast. And at the same time when the stopped program relay also change its state of not OFF. Can I use a conditional loop?

    Your explanation is a bit rough.  But I'll try to help:

    Use a While loop with a stop button.  On the inside of the loop insert your current tracking code.  Compare the current limit by using more function.  The Boolean value to a structure in the event of the wire.  If True, set the code to deactivate the relay.  If False, do nothing.  After the loop, put the code to deactivate the relay.  But you must have a wire from the while loop for the code to deactivate the relay.  You can stop button out of the loop of wire in a sequence structure flat and put the code to deactivate the relay inside the sequence.

  • TCP reference is lost

    I'm asumption that the shift register remembers the last value. My shift register isn't passing reference to service TCP TCP. I think it's to do with the installation of the property. Can sombody help the VI does not have a valid connection.

    In your example - you must connect the Port to be a port number valid (non-zero) and the IP address of the device that you connect to.

    I tried to connect to a Server Web (port 80) on my PC (localhost) and it is without error.

    You need to see where the error is actually generated - this is from the first call that opens the port.

    Your shift register will hold very well the TCP reference. As an aside, it is more common to use a while loop with a true cable at the break only one condition loop to "functional globals ' / 'FGVs' / 'action engines" - Although it is functionally identical to your code.

  • Capture a sample only after analog triggering on a PXI4461 in Labview SignalExpress

    -Repost on LabView forum where this thread belongs.

    Hello

    I capture two waveforms (external excitations) with my PXI446, one on each HAVE. I use one of them as an analog trigger (rising edge @ some tension), let's say AI0. I need the value of AI1 on time (or a fixed number of dt later) when the trigger occurs. I need just a sample.

    (I almost use the 4461 as sample & hold circuit with AI1 as an input signal and the AI0 as the sign of "sample".)

    Currently, I use a "subset and resample" step with a very small dt and it seems that it works, but I don't like.

    The above procedure is in a conditional loop that collects 100 of these samples (acquire signals triggers 100 times) and produces a statistic of this set (using the step statistics).

    Is there a better way to do it?

    Thank you

    Aleksandar Andreski

    Hi Peter,.

    Thanks for your reply.

    I also think the same: do better in LV, rather than SE - LV. I tried the "subset and resample" function before, but as you say, that it cannot be made to select only a single sample. Moreover, the overhead IS are more bigger than in LV and so it slows down other parts of the measure that I have (e.g. a conditional loop).

    I'll probably do a task of LV.

    BTW, if I use LabView Realtime, can he run said fastest loops?

    Greetings,
    Aleksandar

  • control solenoids with USB-6525

    Hi, I'm new to Labview and try to use a USB-6525 control six independent valves.  They'll be turning on and off at different frequencies to control a cell infusion system.  I drew a diagram that allows me to program schedules that the CRDD is closed and open.  The routine is inside a while loop to repeat until a given time has elapsed.  I can duplicate this six times to allow each valve must operate independently.  But I would like to trigger all tasks at the same time.  How do I synchronize loops so they all start at the same time?  Simply put all the loops inside a conditional loop, or it will run the tasks in the order?

    Thank you

    your synchronizeyour can while loops with the help of tax filers, please see the attachment.

    Barros (Certified Developer partner)

Maybe you are looking for