How can I increment a variable in LabView ?

Hello ..
I'm trying to use LabVIEW to increment a variable, but I can't find the right way to do that !
I need to declare a variable and assign zero as its value, then increment it by one each time a certain condition is met, and I need it to reset to zero after it reaches a certain value. It's easy to perform these steps using standard C language but here it looks complicated !
Could someone explain the steps to do that ?
Thanks!

I guess trying to explain how to write a state machine would be difficult..
It should take you 5 mins to implement the solution.  I post so late that it's probably too late for you.
But here goes.
Take a While loop with shift registers as shown in the image of an earlier post.  Place a Case Structure inside the loop.  You will need to use an enumerator (usually create a type def control).  Put 2 states into the enumerator:  reset, increment.  Wire the enumerator to the question mark of the Case Structure.  In the increment case of the Case Structure, you place the +1.  In the reset case you simply wire zero '0' as the proper type (dbl, U32, etc) to the right tunnel of the Case Structure.
In the code somewhere... you need to set the logic to tell the state machine when to reset.  I don't recall reading what that was...  But in any case, you need another shift register to pass the next state to the Case Statement.  Or if that code is embedded into some other code, then it is probably not necessary.  But you will need someting like a selector to choose between Increment and Reset.  Also choose which of the 2 is the default state, probably any of the 2 for now.  The outcome of the logic to reset or increment is obviously wired to the middle terminal of the Select.
Just curious, since you are in this predicament.  Did you tell your boss that you knew LabVIEW in order to get the job and now you are obviously stuck delivering a solution?

Similar Messages

  • How can I use local variable in LabVIEW-Action?

    Hi All!
    There is local variable (for example "MyVariable") in local scope of project. There is Action-step, created by LabVIEW. One of input terminals step is "Sequence Context".
    How can I access to MyVariable by Sequence Context? Unbundle? It does't work.
    Thank you.

    On the TestStand palette there is a VI called TestStand - Get Property Value.vi.  Use that.  Attached is an image showing how to use it.  The trick is making it produce the correct data type.  Do that by right clicking on the VI and selecting Select Type.  Then you can choose the type.  I think in LV 2010 and TS 2010 it is a polymorphic VI and you can just change it.  I wrote an example here for Chaz: http://forums.ni.com/t5/NI-TestStand/How-to-execute-two-steps-in-parallel/td-p/1449874
    It's the second example that's attached.
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~
    Attachments:
    AccessLocalVar.JPG ‏67 KB

  • How can i reuse same variables that i create using c:set var="index" /

    hi all,
    please some one helpme!!!!!!
    how can i reuse same variable that i create using
    <c:set var="index" value="${0}"/>
    cause later in the program i use index to do some condition and based on that i increment ...
    so for example if i say...
    <c:if test="${index==0}">
    <c:set var="index" value="${index+1}"/>
    </c:if>
    will it be like
    if(index==0)
    index++;
    can i do like i did be4. if not what do i need to do to reuse. cause i use the variable atleast 5 time and its keep changing on diff condition level.

    Have you tried it?
    It should work, provided you are on the same page.
    The c:set tag creates the variable in pageScope by default.
    If you forward to another JSP you need to set the scope to be "request" so that it is still available.

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can I set a variable number of values in a SQL IN clause?

    Hi,
    How can I set a variable number of values in a SQL IN clause without having to change the text of the SQL statement each time?
    I read the link http://radio.weblogs.com/0118231/2003/06/18.html. as steve wrote.
    SELECT *
    FROM EMP
    WHERE ENAME IN (?)
    But we need the steps not to create type in the system and would there be any other solution if we would like to use variable number of values in a SQL IN clause ?
    We are using JDeveloper 10.1.3.2 with Oracle Database 10.1.3.2
    Thanks
    Raj

    Hi,
    can you please explain why the solution from steve is not the right solution for you.
    regards
    Peter

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

  • Using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?

    using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?

    Thanks for your swift response.
    That sounds like a good solution, but the code I have on frame 2 is this
    timer = 0;
    countup = function(){
    timer++;
    countupInterval = setInterval(countup,100);
    If I added the same actionscript to frame 3 which has a dynamic textbox with a variable timer attached wouldn't it just put the timer back to 0? What I want is the last known value that was given when it was in frame 2.
    I am thinking of temple run here, I am trying to caculate the total distance(set in the timer variable) from the previous try.
    Hope this makes sense.
    Chazwick

  • How can i load a VI from LABVIEW ver 6.0.1b3 to LABVIEW ver 6.1

    How can i load a VI from LABVIEW ver 6.0.1b3 to LABVIEW ver 6.1......I want to load a vi but i'm getting this error:
    LabVIEW load error code 9:VI version (6.1) is newer than LabVIEW version (6.0.1b3)
    My LabVIEW ver is 6.1
    Please help ......it's important
    Thanks

    I am having similar issues with a *.exe from LV6.1.  I have the runtime engine for 6.1 and recently upgraded to 8.2 from 7.1.  I've never had 6.1 on my machine.  I am able to install this executible and runtime engine on a machine with 7.1 and can run the *.exe fine. 
    I get a load error and am not sure why.  I have had similar issues with old VI's that I have written in 7.1 executing on this machine w/ 8.2
    any suggestions.
    Attachments:
    error.zip ‏14 KB

  • How can I transfer a variable to regexp_replace function

    Hi,
    In addition to my question from yesterday, I went up one (little) level for the next question.
    How can I transfer a variable to regexp_replace function?
    I am getting the value of the variables from from APEX Items.
    The value of item :P105_OLD_NAME should be replaced with the value from :P105_NAME APEX item.
    The projects in PROJECT_NAME field are separated by “:”
    select * from infoux_proj;
    HOSTNAME PROJECT_NAME
    host1 proj2:proj1
    host3 proj1
    host4 proj12:proj1
    host5 proj3
    host2 proj1:proj3:sunproj1
    this is my code:
    declare
    v_old_proj_list varchar(100);
    v_new_proj_list varchar(100);
    begin
    for host in (select a.hostname, project_name
    from infoux_proj a,
    (select hostname
    from PROJECT_NAMES_WITH_HOSTNAMES
    where name = :P105_OLD_NAME ) b
    where a.HOSTNAME=b.hostname)
    loop
    select project_name ,
    regexp_replace(project_name,'(^|:)(:P105_OLD_NAME)(:|$)','\1:P105_NAME \3') new_project
    into v_old_proj_list, v_new_proj_list
    from infoux_proj
    where hostname=host.hostname;
    update infoux_proj
    set project_name=v_new_proj_list
    where hostname=host.hostname;
    end loop;
    end;
    Thanks,
    Sheli

    Hi, Sheli
    Inside quotes, :p105_old_name will not be taken as a variable name. If you want to use the value of :p105_old_name in a string which its otherwise a literal, then you can concatenate the variable to the literal parts, using the || operator.
    You can do soemthing like this:
    REGEXP_REPLACE ( project_name
                , '(^|:)(' || :P105_OLD_NAME
                             || ')(:|$)'
                , '\1'       || :P105_NAME
                             || ' \3'
                )               AS new_projectI'll bet there's a much simpler way to do what you want. Instead of having two SELECTs, a cursor FOR loop and an UPDATE, you can probably do what you need to with just a single UPDATE or MERGE. It would be more efficient, too. If you'd like help, post CREATE TABLE and INSERT statements for all relevant tables and columns azs the exist before this code is run, a couple of sets of values for the bind variables, and the results you'd like to see (that is, the contents of the changed table) for each set, given the same sample data.
    Always say which version of Oracle you're using.

  • How can I get the variable with the value from Thread Run method?

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    // I should get Inside the run method::: But I get only Inside
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    We want to access a variable from the run method of a
    Thread externally in a class or in a method. I presume you mean a member variable of the thread class and not a local variable inside the run() method.
    Even
    though I make the variable as public /public static, I
    could get the value till the end of the run method
    only. After that scope of the variable gets lost
    resulting to null value in the called method/class..
    I find it easier to implement the Runnable interface rather than extending a thread. This allows your class to extend another class (ie if you extend thread you can't extend something else, but if you implement Runnable you have the ability to inherit from something). Here's how I would write it:
    public class SampleSynchronisation
      public static void main(String[] args)
        SampleSynchronisation app = new SampleSynchronisation();
      public SampleSynchronisation()
        MyRunnable runner = new MyRunnable();
        new Thread(runner).start();
        // yield this thread so other thread gets a chance to start
        Thread.yield();
        System.out.println("runner's X = " + runner.getX());
      class MyRunnable implements Runnable
        String X = null;
        // this method called from the controlling thread
        public synchronized String getX()
          return X;
        public void run()
          System.out.println("Inside MyRunnable");
          X = "MyRunnable's data";
      } // end class MyRunnable
    } // end class SampleSynchronisation>
    public class SampleSynchronisation
    public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run
    method "+sathr.x);
    // I should get Inside the run method::: But I get
    only Inside
    class sampleThread extends Thread
    public String x="Inside";
    public void run()
    x+="the run method";
    NB: if i write the variable in to a file I am able to
    read it from external method. This I dont want to do

  • How can I get the variable with the value from Thread's run method

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    /* I should get:
    Inside the run method
    But I get only:
    Inside*/
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    Your main thread continues to run after the sathr thread is completed, consequently the output is done before the sathr thread has modified the string. You need to make the main thread pause, this will allow sathr time to run to the point where it will modify the string and then you can print it out. Another way would be to lock the object using a synchronized block to stop the main thread accessing the string until the sathr has finished with it.

  • How can I convert the variable expression stored as string back to variable expression

    How can I convert the variable expression stored as string back to variable expression?
    I am storing the expression enterd in the TSExpresssionEditControl as simple string and want to convert back to expression since I want to get the data type of that expression.

    pritam,
    I'm not sure what you're trying to do exactly. If you are trying to get the value of a variable and you only have the name of value in a string, then you can use Evaluate() to get its value. If you want the data type, my advise is to use the GetPropertyObject() API method and just pass in the loop up string. Then you'll have a handle to the data object and then proceed from there.
    Regards,
    Song D
    Application Engineer
    National Instrument
    Regards,
    Song Du
    Systems Software
    National Instruments R&D

  • How can I record a video with LAbview?

    Hi,
    I have a question: How can I record a video with labview?
    I have a camera (AXIS 221) connected via rj45 on PC. I see the video of the camera in a browser.
    And I would to acquire the video in labview.
    Could someone help me?
    Thanks
    Raf

    Unfortunately I haven't any experience with this camera. Iguess, you should install API, then crete new VI, place ActiveX container (palette Container->ActiveX) on the Front Panel, then right mouse click, then choose Insert ActiveX object..., then found you camera object and select it and press OK. Then you probably can see image from the on the front panel. Also probably you will be able to get image data in array (how easy is it - depends from the camera API).
    If you able to see image from camera in the Internet Explorer, then another method - you can put Microsoft Web Browser as ActiveX object, then you should also see the image. Disadvantage of this method - you will be not able to get image data.
    Andrey.

  • How can I create a variable size array?

    How can I create a variable size array?

    ok then how can i create a new vector object?If you don't know that, you need to go back to your text book and study some more. Or read the tutorial on the basics of Java: http://java.sun.com/docs/books/tutorial/java/index.html
    After reading that you can move on to: http://java.sun.com/docs/books/tutorial/collections/index.html
    Anyway, the answer to your question is, of course:
    Vector v = new Vector();(But you should probably use ArrayList instead of Vector.)

Maybe you are looking for

  • How to set userName from security context to Criteria in portlet

    Hi, From the portal application I have to get the logged in user and use the same user to filter the records in Portlet. I have to execute a view Criteria in portlet as a default method activity which takes logged in user as a input param. Is this ac

  • Photoshop Elements 8 crashes when "EDIT" opens from Welcome screen

    When Photoshop Elements 8 is launched from the shortcut on the desktop, welcome screen opens and at the bottom it shows "gathering user info....". It keeps doing it as long as I don't click on edit button. When I click on edit button, the edit window

  • ADF swing: JTabbedPane does not display column names.

    Hi all, I have created an ADF Panel, which allows the user to run a few simple queries against an Oracle database done using ADF view objects and ADF view links and ADF application module. From the data control area I drag and drop a view link contai

  • Help Compressor won't open!

    Hi, I had to reinstall FCStudio 2 on my iMAC. Now Compressor just won't open anymore. I tried all the steps suggested by Apple (Disk Permissions, trashing Preferences, uninstalling and reinstalling Compressor). Nothing seems to work. It was working f

  • Remove Zeros

    Is there any function module i can use to remove zeros in a dec field. For example I need to convert 12.300  to 12.3 Thanks.