FUNCTION SLOW - subset of the string

Hello everyone,

in the image of attacched, I have a loop that goes through a 1 d array of strings, searches for items starting with "02" and went back inside their index in the array.

The problem is that it is very slow, it takes about 18 seconds to analyze the overall picture of the file which is long about 20000 pieces. Since I'm on a PC, I expect to do the job in a few seconds.

Any suggestions?

Thanks in advance,

Lorenzo

OK, here's a few things I noticed that could slow things in:

-Nodes of property inside the loop will definitely slow down your loop. It's also dead code - you must update the maximum on the scale once before the loop executes.

-Local variables are also (I don't think marginally) slower than the use of the Terminal. LabVIEW is a data flow language: you must use cables to connect all things!

-Using conditional indexation will cause dynamic memory allocations, because you have to resize the table... you could improve this by preallocating a table for the number of iterations in the loop and then resize the table at the end

Tags: NI Software

Similar Questions

  • Regular expression help please. (extraction of a subset of the string between two markers)

    I haven't used regular expressions before, and I can't find a regular expression to extract a subset of the string between two markers.

    The chain;

    Stuff of header I want
    Stuff of header I want
    Stuff of header I want

    Stuff of header I want
    Stuff of header I want
    Stuff of header I want

    6 ERRORS
                         
    Info I want to line 1
    Info I want line 2
    Info I want line 3
    Info I want to line 4
    Info I want to line 5
    Info I want line 6
    END_ERRORS

    From the string above (it is read from a text file), I try to extract the subset of string between ERRORS 6 and END_ERRORS. The number of errors (6 in this case) can be any number from 1 to 32, and the number of lines I want to extract will correspond with this number. I can provide this number of a caller VI if necessary.

    My current solution, which works, but is not very elegant;

    (1) using Match Regular Expression for the return of the string after you have synchronized the 6 ERRORS

    (2) uses the Regular Expression matches to return all characters before game END_ERRORS of the string returned by (1)

    Is there a way this can be accomplished using 1 Regular Expression Match? If so someone could suggest how, as well as an explanation of the work of the given regular expression.

    Thank you very much

    Alan

    I used a character class to catch any word or whitespace characters.  This put inside parentheses a substring matching the criteria that you can get by developing the node for regular expression matching.  The \d matches the numbers and the two * s repetition of the previous term.  So, \d* will find the '6', as well as "123456".

  • script function IDOC to count the string

    Hello

    Does anyone know if there is any build-up in idoc script function to count the number of string.

    For example:
    A, B, C, D, E

    I want to count how many comma is using script idoc. If there is no generation in function, what would be the best way to achieve this.

    Thank you very much.

    There is no built-in function, but I would simply do this:

    <$rsMakeFromString("MyStringRS", "a,="" b,="" c,="" d,="" e")$="">
    <$numCommas =="" mystringrs.#numrows="" -="" 1$="">

    Good luck and please award points as you wish.

  • subset of binary string by string

    Hello

    a Visca cam command to convert a digital input to a string in hex display mode. Then I need the subset of the string and put a '0' in front of each single channel number.    for example, a digital input is 100, the string in hexadecimal display mode shows 0064. From there, I need to have 00000604. But the subset of string function divides 0064 00 and 64. How can I put a '0' in front of every single number? Is there any function to do this?

    Thanks for help

    Mark

    Hi Mark,

    Here is an example:

    The number 'split' can be replaced by Q & is too...

    Basically, divide your number in appetizers (aka demi-octets). This arithmetic is a little easier than to split strings to insert zeros before each tank.

  • Search and replace the string formatting

    Hello

    I try to do a search and replace the formatting of a string.

    In the example, I'm looking for the string 'SUCCESSFUL', but it must also begin by usbflash and some number + PASSED.

    I can't get the format to have a number between 1 and 99. The number of replacements should add up to 6 in this case. I tried with \d for any number, and I also tried [1-99].

    Make a right-click on the function search and replace the string.  There is an option to use regular Expressions.  Then give it a try.

    EDIT: You need to set the entry replace all to TRUE.

  • Function does not return the correct value

    Hi, I'm having a strange problem and hope someone knows how to solve this problem...

    I try to send a string to a function in another class and do return to a textfield, so I can add it to a movieclip and on the stage. I use it for several buttons. The problem is when I put that a string in it value returns a string for the previous call to the function that is not the string value that I want to use. Here's the function:

    public void replaceMCTxt (mcString:String, xPos:Number,

    yPos:Number, rolloverText:Boolean, newFontSize:uint, height: uint, width: uint = false): {TextField

    var newMCTxt:TextField = new TextField();

    newMCTxt.x = xPos;

    newMCTxt.y = yPos;

    newMCTxt.width = width;

    newMCTxt.height = Height;

    var textFormat:TextFormat = new TextFormat();

    textFormat.align = _gameModel.screenFontAlign;

    textFormat.size = newFontSize;

    textFormat.font = _gameModel.screenFont;

    textFormat.color = _gameModel.screenFontColor;

    newMCTxt.defaultTextFormat = textFormat;

    newMCTxt.text = _languageClass.getTranslation (mcString);

    newMCTxt.selectable = false;

    Return newMCTxt;

    }

    I try to call with this statement in another class:

    _moreGamesTxtField = _updateLanguageClass.

    ("MORE GAMES", _gameModel.moreGamesTxtXPos, replaceMCTxt

    _gameModel.moreGamesTxtYPos, _gameModel.moreGamesTxtWidth,

    (_gameModel.moreGamesTxtHeight, _gameModel.moreGamesTxtFontSize);

    Instead of giving me a movieclip "MORE GAMES", it gives me a 'PLAY' movieclip, which is what the previous call to the function used. I also had a similar problem in another function where he did the same thing with filtering of different buttons, so I think the problem is in the service, but I'm not programmer to know that it's good enough. If anyone has an idea please let me know. Thank you...

    Start the survey using the trace() function to see what value is passed to and returned by some _languageClass.getTranslation ().

  • Subset of the Serial error string

    Hello world

    I have a simple program. I used arduino to transfer a string to labview.

    And in Labview, I want to chain of subset. But she works only first string and the strings later be not subset.

    Can you help me find my error?

    Thanks for reading

    Here is my code and my mistake

    Here is my video: https://www.youtube.com/watch?v=Gm5nOrZ3iyo

    Here's my arduino code:

    #include
    #include
    int i = 0;
    LiquidCrystal_I2C lcd (0 x 27, 20, 4);  set address 0 x 20 for a 2 line display and 16 characters LCD

    void setup()
    {
    LCD.init ();    initialize the LCD
    Serial.begin(9600) (9600);
    attachInterrupt(0,irt1,CHANGE);
    attachInterrupt(1,irt2,FALLING);
    Print a message on the LCD screen.
    LCD.backlight ();
    LCD. Print ("Hello, world!");
    Serial.Print ("Hello, everyone");
    Delay (1000);
    LCD. Clear();
    }

    void loop()
    {

    While (Serial.available ())
    {
    tank r = (char) Serial.read ();
    if(r=='t')
    {
    lcd.setCursor (0,0);
    LCD. Print ("you're a robot");
    Serial.Print ("you robot\n");
    }
    ElseIf (r = ' a')
    {
    lcd.setCursor (0,0);
    LCD. Print ("you're human");
    Serial.Print ("you human\n");
    }
    }
    }

    Sub irt2()
    {
    Delay (1500);
    i ++ ;
    If (i %2)
    {Serial.print ("ngaysinh010071992\n") ;}
    on the other
    {Serial.print ("ngaysinh123455\n") ;}
    }

    I advanced and did a cleansing of your diagram.  See if that makes sense.

  • The doc for the function of the subset of the table shows the extensible function

    In LabView 2010 the doc for the function of the subset of the table shows that the function is expandable with indexes and multiple lengths. I can't expand the function for multiple indexes. How can I do this?

    Is the documentation for the function by mistake, or is there another function of a subset of the table somewhere that can do this?

    Subset of table details

    When wire you an array to the function, the function is automatically resized to display entries index for each dimension of the array. If wire you a table 1 d to the function, the function displays the index for an item entries. If wire you a 2D to function, the function table displays the entries index for a line and column, respectively. If wire you a 3D through the nD to the function, the function displays the index for a page entries.

  • [ACCIDENT] Crash when using ' equal to ' function of the String class

    When I use "equal to" function of the String class to compare 2 channels, the app will crash.

    Examples: pn_infopush.equals (PN_INFO_TIMER)

    I have to use "is" instead of "equal". The application will run normarly

    Does anyone have any idea who? I don't understand why.

    Thanks for your support!

    Hello

    Is there a chance that your variable can get a null value?

    Calling .equals not a null object can cause this.

    What type of exception you get? Can you provide a stacktrace?

  • SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    Hello

    You can use REGEXP_SUBSTR Oracle/PLSQL: REGEXP_SUBSTR function

    Select the function double REGEXP_SUBSTR('PUBLIC RELATION REPRESENTATIVE ','[^]+',1,2);

    Do you have any value of the column as no 2nd string?

  • Expection while using the string (compare-ignore-case, uppercase) function

    Hi all

    I am using soa suite 11.1.1.6

    JDeveloper 11.1.1.6

    I tried to use the string functions (only 2 xp20:upper - box (), oraext:compare-ignore-case()) with an xpath expression. But it is throwing an error saying that the xpath expression is invalid. I used the same xpath expression in an assign activity that works very well. The string functions are works well when it is used with constants. But the case failed when they are used together this way

            <assign name="Assign1">
                <copy>
                    <from expression="bpws:getVariableData(xp20:upper-case('inputVariable','payload','/client:LoanEligibiltyRequest/client:LoanType'))"/>
                    <to variable="HL"/>
                </copy>
            </assign>
    

    This is the log

    < 1 July 2013 19:07:10 IST > < error > < oracle.soa.bpel.engine.dispatch > < BEA-0000

    00 > < could not handle message

    javax.xml.xpath.XPathExpressionException: internal error xpath

    at oracle.xml.xpath.JXPathExpression.evaluate(JXPathExpression.java:242)

    at com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate(BPELXPathUtil.java:)

    247)

    Thanks in advance

    It may be wise to cast to a string also. Sometimes you get the signatures of the rear instead of content element if you specify.

  • Name of the string function

    Y at - it a good way to get the name of a function in as3 in a string or a string. I saw the devious means forcing a call error and stack trace, but it's not what I'm looking for.

    Thank you!

    1. you can retrieve a string representing a function name, but you have to code so that, for example, extending the class of service.

    2. you can loop through an object and find the property strings that point to everything including the Datum features.

  • Extract the substring of the string

    For the life of me I can not find a function to extract a substring of an existing string.  The closest I could find was SearchSplit String and replace substring, but none of them do what I want.

    That's what I want to do:

    Assuming that the string "Test String", the letters are in positions as follows:

    T e s t _ S t r i e n t
    0 1 2 3 4 5 6 7 8 9 10

    Now correct the substring offset 5 on position 7 (length 3):

    Substring = r t S

    5 6 7

    In Java, for example, you can easily do this using the code below:

    String str = "Test String";

    Substring of String = str.substring (5.7);

    There are no simple function to do this in LabVIEW?  If not, what is the best way to do it?

    Use String subset of index 5 and length 3.

  • Incorporate the binary string in the string spreadsheet file

    Hello LabVIEW wizards...

    So I use scripture to VI file spreadsheet to create a beautiful layout, tabs-delimited report of one of my programs for the acquisition of data file. In one of the cells in the resulting worksheet file that I want to put a binary string of all my control values so when you open the data file all the control parameters used for its manufacture are restored, but the string is hidden when the report is displayed in Excel.

    The problem is that the binary string flattened uses tabs and returns as part of its syntax the Spreadsheet File this VI to Write it's going in all directions. Worse yet, I can't unflatten chain when I open the file text because of "corrupt data or unexpected".

    If I concatenate the string flattened with quotes around it she is superb and is placed in a single cell in Excel, but when I open the file in LabVIEW that she is still several elements in the array. I've isolated the binary string using the file VI text reading and got a subset of the quoted string, but it still unflatten correctly.

    Essentially, I need to know how to get LabVIEW to pull a string literal full of special characters into a spreadsheet file and it unflatten. Any gurus what help you can provide is greatly appreciated.

    Thank you

    Jordan

    Jordan

    I suggest that you change the formatting of your chain shipped by replacing the tabs and returns with other characters that are not considered as commands by the spreadsheet functions. Without knowing how you represent your control binary values, I can't offer specific characters.

    If two non-printable characters exist which do not appear in the control data, it's easy: just find and replace tabs and returns with those characters.  If there is no character, then something more complex needs to be done for example to escape special characters.  Or create two subVIs - one to remove the tabs and returns before writing the string in the file and the other to restore after reading.

    Lynn

  • Reverse the string

    Y at - it another simpler way to reverse the string (without using the "Reverse String" function) using labVIEW in addition to that I have tried in this attached below VI?

    Thanx.

    Use string subset in a loop with the subset of string length is 1 and decrement the offset of the string Max Length to zero.

Maybe you are looking for