To count the number of while loops, do you just have to attach a DBL indicator to the little i box in the while loop of the program?

I have just followed an example in a book to count while loops and was just want to make sure I havent missed something simple. My program is attached
Solved!
Go to Solution.
Attachments:
second attempt.vi ‏45 KB

Hi Ssteel,
Just some additional observations/tips on your code...
1. I notice that you have a standard stop button going into a "run if true" stop condition of the while loop. In this cercumstance it is common to have the stop condition set as "stop if true". You can change this by right clicking the stop terminal and enabling the "stop if true" property. Obviously, it somewhat depends on your design preferences.
2. If you have any issues with the application, perhaps you notice that it is taking over your processor resources, you should add some execution timing into the while loop. You will find the timing functions in the block diagrams functions palette (programming > timing). The Wait (or "wait until next ms") functions will provide your application with "down time", which means that the processor can execute other tasks.
3. To elaborate what MikeS81 correctly stated, insert an incriment before the numeric indicator as shown below to get the actual number of cycles (i.e. the count terminal of the "while" and "for" loops are 0 indexed). Also note that I have changed the representation of the count to interger (blue). You do not need floating point precion when displaying the inciment count, at a while loop can only execute a "whole number" of times.
I hope this has been useful to you Ssteel.
Thanks for your post,
Rich R
Applications Engineer
National Instruments UK & Ireland

Similar Messages

  • HT4623 Hello, I'm brazilian and I,ll be in Minneapolis at 10-15-2012 and I'd like to know if you just have iphone 5 unlocked  at Minneapolis Apple Store or just to book and receive later in the hotel?? Thanks in advance.

    Is there iphone 5 just unlocked to be sold in Minneapolis Apple Store?

    Apple has not yet announced when unlocked iPhone 5s will be available.
    Please be aware that you are not communicating with Apple when you post in these forums. The only people who will reply to your posts are your fellow users.
    Regards.

  • My ipad says it can't connect to the server although other in the house are able to.  Sometimes turning it on and off seems to help.  Other times you just have to keep trying.

    My ipad says it can't connect to the server although other computers in the house  one the same wifi are working fine.  Sometimes turning it on and off will help.

    KKbrummund, thank you for sharing your concerns about your Kin device. I understand that it can be frustrating having these issues with a new device. At this point, since the phone is able to access internet, but just can't connect to Windows Live, there may be a problem in the phone itself. We can submit a trouble ticket to our network team to see if there are any network issues causing this. Also, if you are within your 14 day worry free guarantee (this may be different for some indirect agent locations) you may want to try exchanging your device.
    Please let me know what option you decide to take. If you are past the worry free guarantee or have had the phone exchanged already, I can submit the trouble ticket for you.
      MarquiaF_VZW
    Follow us on Twitter @VZWSupport

  • "Invalid license number cannot open photoshop cs5" popped up after I installed the program. I can't open it

    I Just bought Photoshop cs5 extened. I put in correct serial number but the message keep popping up as "invalid number" after it said installed successfully. I can not open the program. WHY!!!!,  @

    Try... Error "The serial number is not valid for this product" | Creative Suite
    http://helpx.adobe.com/creative-suite/kb/error-serial-number-valid-product.html
    If you just bought the software, which Adobe no longer sells, it might be a problem with whoever sold it to you.

  • Counting the drop-down selections

    Hi everybody.
    The scenario is:
    The user has a filter with 20 product lines, for each he must to edit any cells in the layout. He select one, make changes, save, choice other product line in the filter, edit any cells, save, etc...
    I need to make a counter that show to user which product line that he had changed, like an input field, but just to show the product lines changed. who can help me?
    Regards.
    Fábio P. Copetti - Brazil - BI-One
    SAP-SEM

    Hi,
    Welcome to SDN.
    It seems that you are using a tableView to display the data. If so, just reserve 1 column 'change Flag' that will hold this piece of information.
    In the OnInputProcessing event, you would surely determine whick row is accessed. Thus, you just have to update the column 'change Flag' of this row for the User to remember he/she has already made modifications.
    As the layout is rendered, the screen is modified and the column 'change Flag' along with it...
    Best regards,
    Guillaume

  • How to count the Threads, waiting on object's lock?

    Hello!
    I have a vector of the objects. Some threads are waiting on this objects using method wait() to be notified on this object's monitor.
    I will remove an object from the vector in order to save a memory, if there is no threads waiting on it, but how I undestand it?

    You could keep count on how many threads are waiting
    on a particular object and then you'd know it's OK to
    remove the object if this count is zero. Then, of
    course, you'd have to modify your code to increment
    one such count each time a thread is about to call
    wait() and decrement it after the wait() call. (If you
    do that then remember to synchronize the counter
    modification code properly.)Simple way to do this...
    In the object that is being waited on, if you can extend it...
    int nWaiting = 0;
    public synchronized void doWait() {
       nWaiting++;
       wait();
       nWaiting--;
    public sychronized int waitingCount() {
       return nWaiting;
    }Note that this count may still be off if some code uses wait() instead of doWait(). If you have control over the objects that are supposed to be waiting on a given monitor, then waitingCount() will give you an indication of if any are currently waiting.
    Hope this helps,
    -Troy

  • Photoshop elements 12 editor doesn't open, organizer is fine. I uninstalled the program and re-installed it (restarted the computer each time)...didn't solve the problem. using pc, windows 8.1

    photoshop elements 12 editor doesn't open, organizer is fine. I uninstalled the program and re-installed it (restarted the computer each time)...didn't solve the problem. using pc, windows 8.1
    can someone help me with this issue?

    Two suggestions:  the first one is a workaround. You just have to drill down your program file tree to Adobe Photoshop Elements Organizer and find the .exe file - the one specifically for Organizer, not Elements.  Make a shortcut to that file on your desktop and it will open Organizer. The second suggestion resolved the problem altogether for me. I actually called Dell and after working with several different techs over several different days, I talked to a tech in premium support who was excellent. I discovered from them that it is actually a problem with the windows system files. I have 8.1.  I went through a "refresh" on my computer which rebuilt all the files. Then reinstalled Adobe as well as my other programs again and Photoshop Elements Organizer works from the standard desktop shortcut.

  • Everytime I open Illus CS5 in mac LION the program opens the last file I have used

    Hi there! I´m having this problem... I close the file, I close the program; bur when I open it again the Illustrator opens the last file I have work with.
    Is this a bug? I tried with various files, reboot my mac, but nothing changes
    Thanks a lot

    joaquin23 wrote:
    I check every feature and doesn´t find anything.
    Well, I guess you just have to look again:
    joaquin23 wrote:
    Also I create a new file, then erase it from the mac and when illus starts up the file opens again!
    Okay, that's a bona fide miracle.
    (Don't you just LOVE to hate Lion? I de-Lionized it as much as it allowed, and now I'm sorely missing double-left swipe navigation ...)

  • How can I count the number of times a timed loop finished late?

    I am getting occasional timing errors in a timed loop under windows XP and would like to count the number of errors, but I can't find a simple software counter vi

    The timed loop has a terminal (boolean) to indicate if the previous iteration finished late. Just increment an integer shift register if this happens.
    The attached shows a very simple demo (LabVIEW 7.1).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    LateCounter.vi ‏76 KB

  • How to count the number of rows in a resultser object?

    hi there
    how to count the number of rows in a resultser object which may contains millions of rows? besides using a while loop? thanks

    You don't, you execute a query whose result is the record count of those records that match the search and then you execute the actual query to create your record set. Typically you do
    select count(id) from YourTable where [filter]
    from the resulting ResultSet do
    int res.getInt(1);
    which gives you the count and then
    select id from YourTable where [filter]
    to produce the actual result set.
    in the second query the id part can be substituted with the actual fields you want.

  • How to count the number of 'True' outputs from an 'Equal?' function?

    In my program, I have an 'Equal?' function which returns 'True' whenever x=y. How can I count the number of 'True' and display? I mean, for example, when it say True, the counter should display '1', when it say true next time the counter should display '2', like wise 3, 4.... so on. Can any one help me to do this? Is there any function which conts and display the number of 'true' outcomes?

    Is your event structure in a while loop?  Then that's where the shift register can go.  But for portability a feedback node can be used if the VI is not reentrant.
    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.

  • A quick way to count the number of  newlines '/n' in string of 200 chars

    I am trying to establish the number of lines that a string will generate.
    I can do this by counting the number of '/n' in the string. However my brute force method (shown below) is very slow.
    Normally this would not be a problem on a 2800mhz Athlon (Standard) PC this takes < 1 second. However this code resides within a speed critical loop (not shown). The code shown below is a Achilles heal as far as the performance of this speed critical loop goes.
    Can anyone suggest a faster way to count the number of �/n� (new lines) within a text string of around 50- 1000 chars, given that there may be 10 � 100 newline chars. Speed is a very important factor for this part of my program.
    Thanks in advance
    Andrew.
        int lineCount =0;
        String txt = this.getText();
        //loop throught text and count the carridge returns
        for (int i = 0; i < txt.length(); i++)
          char ch = txt.charAt(i);
          if (ch == '\n')
           lineCount ++;
        }//end forMessage was edited by:
    scottie_uk
    Message was edited by:
    scottie_uk

    Well, here is a C version. On my computer the Java version (reply 9 above) is slightly faster than C. YMMV. For stuff like this a compiler can be hard to beat even with assembler, as you need to do manual loop unrolling and method inlining which turn assembly into a maintenance nightmare.
    // gcc -O6 -fomit-frame-pointer -funroll-loops -finline -o newlines.exe newlines.c
    #include <stdio.h>
    #include <string.h>
    #if defined(__GNUC__) || defined(__unix__)
    #include <time.h>
    #include <sys/time.h>
    #else
    #include <windows.h>
    #endif
    #if defined(__GNUC__) || defined(__unix__)
    typedef struct timeval TIMESTAMP;
    void currentTime(struct timeval *time)
        gettimeofday(time, NULL);
    int milliseconds(struct timeval *start, struct timeval *end)
        int usec = (end->tv_sec - start->tv_sec) * 1000000 +
         end->tv_usec - start->tv_usec;
        return (usec + 500) / 1000;
    #else
    typedef FILETIME TIMESTAMP;
    void currentTime(FILETIME *time)
        GetSystemTimeAsFileTime(time);
    int milliseconds(FILETIME *start, FILETIME *end)
        int usec = (end->dwHighDateTime - start->dwHighDateTime) * 1000000L +
         end->dwLowDateTime - start->dwLowDateTime;
        return (usec + 500) / 1000;
    #endif
    static int count(register char *txt)
        register int count = 0;
        register int c;
        while (c = *txt++)
         if (c == '\n')
             count++;
        return count;
    static void doit(char *str)
        TIMESTAMP start, end;
        long time;
        register int n;
        int total = 0;
        currentTime(&start);
        for (n = 0; n < 1000000; n++)
         total += count(str);
        currentTime(&end);
        time = milliseconds(&start, &end);
        total *= 4;
        printf("time %ld, total %d\n", time, total);
        fflush(stdout);
    int main(int argc, char **argv)
        char buf[1024];
        int n;
        for (n = 0; n < 256 / 4; n++)
         strcat(buf, "abc\n");
        for (n = 0; n < 5; n++)
         doit(buf);
    }

  • How to count the number of deleted rows processed

    Sybase ASE version: 15.7-SP52
    Hi all,
    I have a delete statement that will potentially delete millions of rows
    DELETE from TAB_A where COL_A='Y'
    The delete is long, at some point I'd like to know how many rows were deleted.
    If I do SELECT COUNT(*) from TAB_A where COL_A='Y', the query should be locked because of the exclusive-lock held by the DELETE in progress.
    If this is the case, how can I actually count the number of rows deleted so far?
    Thanks all
    Simon

    Simon
    For  deleting significant number of rows best practice is to delete rows in small batches of known size (e.g. 10 K) inside a while loop. 
    This keeps transaction log from filling up as well.
    Also between two iterations of delete you can give some wait to make sure that you do not monopolize the server. Sleep could be for a fixed number of seconds (e.g. 5) or for randomized number say from 1 to whatever makes sense.
    Typically "set rowcount " is used to set up the batch size and "waitfor delay" to sleep between iterations.
    Global variable @@rowcount gives yo actual rows deleted. For the last batch this may be lower than the batch size you set up.
    HTH
    Avinash

  • Count the Records in  an internal table without a loop.

    How do i count the number of records in an internal table without using the loop  statement.
    The Describe statement give the total no. of records in the internal table.But i want the count of the key fields in the internal table
    For eg
    Row Field
    1       A
    2       A
    3       A
    4       B
    5       B
    6       C
    Count of A = 3
    Count of B = 2
    Count of C = 1

    Dilip,
      I think isn't posible. Only 3 ideas:
    1ª, make other table "table2", similar to your actual table.
         table2[] = yourtable[].
         delete table2 where key <> 'A'.
         describe table table2 lines contA.
        But depending the amount of data, you may have problems in performance or memory consumption...
    2ª, make other table, only with the keys fields and a count field,
        data begin table2
           key_field1,
           cont type i.
        end data.
       when you append lines to yourdata, make a collect to this table:
        table2-keys = yourtable-keys.
        table2-cont = 1.
       collect table2.
       But only works if you can modify the program where data is appended, and you may be carefull when data is deleted :-(...
    3ª if your data if filled in a select, you may fill the table2 of point 2ª, making a similar select but:
       select keyfields count( * ) into table table2
      from ...
      where (the same you have to fill your original table...)
       group by keys.
    But you have the same problem is data is deleted later...
    I hope that any of the three is useful for you...
    Edited by: Diego Alvarez on Jan 5, 2010 5:09 PM

  • How to Count the number of TAB chars value '0A' in a line?

    I have a requirement to count the number of TABs in a text file that I am processing (they must equal 75) to ensure that all the fields have been submitted on the file I am reading?
    How do I identify the TABs in a line?
    I have this so far:
             CONCATENATE gv_unix_file gv_lstfiles-name INTO gv_unix_file.
              OPEN DATASET gv_unix_file for INPUT IN TEXT MODE ENCODING NON-UNICODE.
              IF sy-subrc <> 0 .
                message e000(zz) with 'Cannot access in_uk files'.
              ENDIF.
              CONCATENATE gv_unix_file_arc gv_lstfiles-name INTO gv_unix_file_arc.
              OPEN DATASET gv_unix_file_arc FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
              IF sy-subrc <> 0 .
                message e000(zz) with 'Cannot access in_uk files'.
              ENDIF.
              DO.
                READ DATASET gv_unix_file into lv_str.
                IF sy-subrc <> 0.
                  exit. "exit do loop, file is done.
                else.
                  TRANSFER lv_str to gv_unix_file_arc.
                ENDIF.
              ENDDO.

    Here is a sample code:
    DATA: lv_string TYPE string,
          lv_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
          lv_i TYPE i.
    DATA: result_tab TYPE match_result_tab.
    DO 3 TIMES.
      CONCATENATE 'A' lv_string INTO lv_string SEPARATED BY lv_tab.
    ENDDO.
    " this is how you need to find how many tabs are in your transfer work area...
    FIND ALL OCCURRENCES OF lv_tab IN lv_string RESULTS result_tab.
    DESCRIBE TABLE result_tab LINES lv_i.
    WRITE:'No. of tabs found:', lv_i.

Maybe you are looking for