How to avoid Build Array function inside a For (while) Loop?

Hi there,
I have a simple question about how to avoid using Build Array function inside the loop. Now I want to remove the Build Array funtion inside the loop to improve the performance (To get better memory management). Any idea how to do that?
Thanks a lot!
Warmest regards,
Chong

It's been my experience that using the auto-indexing to build an array
on a For loop is just as good as initializing and replacing elements.
The For loop knows before it runs how many iterations it has to run and
can allocate the array ahead of time.
You're better off initializing and replacing when using a While loop
because it does not know how many iterations it will run and can't
pre-allocate the array ahead of time.
Ed
Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

Similar Messages

  • Cascade two Build Array functions - what happens?

    I found the the code shown in the attachment in a very complex VI that I am overhauling.  Would someone explain to me what is happening with the "cascaded" Build Array functions.
    I can see that the first Build Array function builds a 1D array of integers which passes to the second Build Array function which outputs a 2D array of integers but, since there is no Element or second Array input, I don't see how this works.
    This is part of a subVI that is not embedded in a loop.
     All the examples have at least two inputs.  With one input there is no Concatenate Inputs option. There is some implicit operation here that I do not understand.
    Would someone explain how this works? 
    Solved!
    Go to Solution.
    Attachments:
    Cascade two build array functions.PNG ‏7 KB

    You are taking a scalar value and creating a 1-D array with exactly 1 element.
    Then you are taking the 1-D array and building it into a 2-D array, with exactly 1 element.
    Since you can't concatenate something with nothing, the only logical mode for the Build Array would be to build it into an array of the next larger dimension.
    You could add a third one, then you'd have a 3-D array with exactly 1 element.  And so on.

  • Reporting Services - How to open a second table inside report, for each number of client (each apears in first table)

    Reporting Services - How to open a second table inside report, for each number of client (each apears in first table)?
    Exemple:
    Table1
    Cliente name:
    John
    Client number:
    12345
    Survay number of negative answers:
    3
    Table2
    Questions and answers that were negative:
    Question: How much time where you waiting
    Avaluation: 3 (from 1 to 10)
    Answer: They only called me 1 mouth later
    Can you please help me?

    Hi,
    Based on the description, I understand that you want to add subreport in the main report. When previewing the main report, the subreport can be shown in detail. Please see the screenshots on my test:
    In Reporting Services, we can create parameters and pass them from main report to subreport in order to control the data dynamically.
    References:
    Subreports (Report Builder and SSRS)
    Add a Subreport and Parameters (Report Builder and SSRS)
    If I have any misunderstanding, please feel free to contact me.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to avoid duplicate posting of noted items for advance payment requests?

    How to avoid duplicate posting of noted items for advace payments request?

    Puttasiddappa,
    In the PS module, we allow the deletion of a component pruchase requisition allthough a purchase order exists. The system will send message CN707 "<i>A purchase order already exists for purchase requisition &</i>" as an Iinformation message by design to allow flexible project management.
    If you, however, desire the message CN707 to be of type E you have to
    modify the standard coding. Doing so, using SE91, you can invoke the
    where-used-list of message 707 in message class CN, and to change the
      i707(cn)
    to
      e707(cn)
    where desired.
    Also, user exit CNEX0039 provides the possibility to reject the
    deletion of a component according to customers needs e. g. you may
    check here whether a purchase order exists and reject the deletion.
    Hope this helps!
    Best regards
    Martina Modolell

  • How to avoid the Amount and Date values for VOID Cheques

    Hi All,
    I had created a two window i.e For Amount and Date. If I process the cheque the Amount value and Date should not trigger for VOID CHEQUES.
    Can any one tel me how to avoid the Amount and Date values for VOID Cheques
    Your help will be greatly appreciated.
    Regards
    Yathish

    Hi,
    I dont know which tablel you are referring to, is it PAYR table and the field VOIDR?
    If a cheque is voided, it would have a reason and it is stored in VOIDR field of this PAYR table.
    Check if the field VOIDR is filled, if it is filled, do not print the amount and date.
    Regards
    Subramanian

  • How to speed up my code inside the for loops,

    how to speed up my code inside the for loops using c# WinForm.

    Hi  John,
    Please take a look at the reply from Wyck in the following thread.
    How to speed up for loop?
    His answer is very comprehensive.   Thanks.
    Best regards,
    kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to make the exchange of data between 2 while loop in real time

    hello
    I have 2 while loop
    the 1st while loop includes the data acquisition program
    the 2nd while loop includes the control program
    my question is how to make the exchange of data between 2 while loop in real time
    I tried with the local variable and direct wiring between the 2 while loop
    it does not work (there is a delay)
    Solved!
    Go to Solution.

    Bilalus,
    Queues are only good to transfer data if your application isn't deterministic. Since you are using Real Time, I am assuming that your application requires determinism. If you are using Timed Loops and you use queues to transfer data between your loops, you are losing determinism. In this case, you need to use the RT FIFO functions. 
    Warm Regards,
    William Fernandez
    Applications Engineering
    National Instruments

  • How to get the last error for while loop?

    How to get the last error for while loop? I just want transfer the last error for while loop, but the program use the shift register shift all error every cycle.

    What do you mean by "get" and "transfer"?
    If the shift register is not what you want, use a plan tunnel instead.
    Typically, programmers are interested in the first, not last, error.
    Can you show us your code so we have a better idea what you are trying to?
    LabVIEW Champion . Do more with less code and in less time .

  • Usage of for-each loop inside another for-each loop

    Hi All,
    I have tried using a for-each loop inside another for-each loop as given below.
    <?for-each:G_1?>
    <Customer Details>
    <?for-each:G_2?>
    <Address>
    <?end for-each?>
    <?end for-each?>
    Its not getting inside the second loop.I have referred this link
    Re: Loop Question but it didn't help me much.Please let me know if am going wrong somewhere.
    Regards,
    Sudeep.

    Sudeep,
    The syntax of the for-each statements looks oke. but you have omitted some question marks after the < and before the >.
    Furhermore, there cannot be spaces in XML element names. So, "Customer Details" won't work. Change it to something like: "Customer_Details". Also be reminded that the element names are case-sensitive.
    try this:
    <?for-each:G_1?>
    <?Customer_Details?>
    <?for-each:G_2?>
    <?Address?>
    <?end for-each?>
    <?end for-each?>
    Regards,
    Kevin

  • How to use 'build array' (concatenate) to create a array horizontally?????HELP

    I want to link nine arrays whose dimension is 2*2 horizontally,but the function 'build array' (concatenated way) made them vertically.........help me please..........maybe this is too simple.........since I am only a students who learnd labview only few months..
    Solved!
    Go to Solution.

    A transpose operation only solves certain scenarios, but you don't give enough information on what you actually want.
    For example, of you have 3 2x2 arrays:
    a1 a2     b1 b2     c1 c2
    a3 a4     b3 b4     c3 c4
    What should the final vertical result be?
    a1 a2
    a3 a4
    b1 b2
    b3 b4
    c1 c2
    c3 c4
    or
    a1 a3
    a2 a4
    b1 b3
    b2 b4
    c1 c3
    c2 c4
    Or something else?
    Please be much more specific. Maybe even attach a small VI containing typical default data.
    LabVIEW Champion . Do more with less code and in less time .

  • How to call proceduer or function inside LOV of oracle apex

    Hi all,
    how to write statement to call proceduer or function inside LOV of oracle apex?
    Edited by: akki.kumar on Sep 2, 2010 12:25 AM

    Hi,
    Example how call procedure inside dynamic LOV and retrun lov from emp table
    DECLARE
    BEGIN
    my_procedure;
    RETURN 'SELECT ename d, empno r FROM emp';
    END;Regards,
    Jari
    Edited by: jarola on Sep 2, 2010 10:42 AM

  • How to call the 'DETAIL' function in ALV for a program?

    Dear Friends,
    I have a prf_tree (TYPE REF TO cl_gui_alv_tree), and I added below codes to add an new button for displaying the detail record, it works fine:
    CALL METHOD prf_toolbar->add_button
        EXPORTING
          fcode     = prf_tree->mc_fc_detail
          icon      = icon_detail
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Show Details'.
    Everytime I click this new button, a window will popup and display the record details.
    My question is: how to call this standard function  ('DETAIL' function) in a program? for example:
    CASE ldf_ok_code.
        WHEN gcf_okcode_save.
          PERFORM okcode_save.
        WHEN 'SHOW_DETAIL'.
          CHECK  gdf_nodkey_9003 IS NOT INITIAL.
          PERFORM SHOW_DETAIL.(How to write this code to display the detail data of the selected record?)
      Thanks a lot!

    Hi,
    Go for Interactive Reporting
    like When u click on the output then it will show the Detail report u want .
    for that purpose Pls
    Use Hide command .
    And call another report
    by using SUBMITT Program

  • How to get an array variable to update in a loop

    Hi
    I have an array of doubles called cps that contains a double h.
    the array is defined out of the loop.
    The loop defines the value of h and uses that array to do something. How can I get the array to update h at every iteration of the loop?
    // STAR-CCM+ macro: test.java
    package macro;
    import java.util.*;
    import star.common.*;
    import star.base.neo.*;
    import star.vis.*;
    import star.base.report.*;
    public class test extends StarMacro {
    public void execute() {
    double h ;
    int i;
    double[] cps= new double[] {75.9042408986955, 52.51153872409542, h, 76.51180919240942, 49.49901260109725, h, 77.70163043426585, 49.67622002009714, h, 78.35982941912259, 46.537117169241895, h, 78.08136061783705, 45.42324196409971, h, 75.67640278855279, 44.840989015957206, h, 68.73999810198555, 40.942425797959565, h, 66.66413976512966, 44.511889523528836, h, 67.85396100698608, 44.99288108938568, h, 68.81594413869979, 45.65108007424243, h, 69.37288174127089, 46.081440948956455, h, 68.99315155769969, 46.992793389527336, h, 68.38558326398577, 48.005407212383865, h, 67.8792763525575, 48.81549827066909, h, 73.423337032697, 51.954601121524334, h};//coordinates of constrained section plane
    Simulation simulation_0 =
    getActiveSimulation();
    // CREATING CONSTRAINED PLANE SECTIONS //
    Region region_0 =
    simulation_0.getRegionManager().getRegion("main domain;main domain;NONE");
    Units units_0 =
    ((Units) simulation_0.getUnitsManager().getObject("m"));
    i = 0;
    for ( h = 0.5; h <= 2; h = h + 0.5) {
    i = i + 1;
    ConstrainedPlaneSection constrainedPlaneSection_i =
    (ConstrainedPlaneSection) simulation_0.getPartManager().createConstrainedPlaneImplicitPart(new NeoObjectVector(new Object[] {region_0}), new DoubleVector( cps ), units_0); // Sets Plane Boundaries (as mapped) //
    LabCoordinateSystem labCoordinateSystem_0 =
    ((LabCoordinateSystem) simulation_0.getCoordinateSystemManager().getObject("Laboratory")); // Defines Lab Coordinate System (Does this once). //
    constrainedPlaneSection_i.setCoordinateSystem(labCoordinateSystem_0); // Sets this planes coordinate system //
    Coordinate coordinate_i =
    constrainedPlaneSection_i.getOriginCoordinate();
    coordinate_i.setCoordinate(units_0, units_0, units_0, new DoubleVector(new double[] {71.92329015, 46.4835809, 0.5})); // Sets the origin for the plane //
    constrainedPlaneSection_i.setPresentationName("Unit 1 " + h + "m");
    }

    double h ;
    double[] cps= new double[] {75.9, 52.5, h, 76.5, 49.4, h,  // simplifiedLooking at your code I see that you have initialised your array with the value of the variable h scattered throughout it. Are you asking how you can update these "h" values in the array each time around the loop? eg:
    Initial array: 75.9, 52.5, 0.0, 76.5, 49.4, 0.0
    1st iteration: 75.9, 52.5, 999.999, 76.5, 49.4, 0.0
    2nd iteration: 75.9, 52.5, 999.999, 76.5, 49.4, 999.999
    Something like that.
    If so then you need to know what the indicies of the numbers you want to update which may not be a simple matter. Perhaps an array is not what you want here but maybe a Map instead.

  • How do I break a for loop (inside) and a while loop (outside) at the same time by a control button

    I have a while loop (outside) and a for loop (inside) and a control button within the for loop.  I want to stop the program by click the botton without finishing the for loop.  How can I do that?
    Thank you in advance.

    HI Please find attached snapshot Regards, Santosh
    Message Edited by SanRac on 12-17-2009 05:12 AM
    Message Edited by SanRac on 12-17-2009 05:13 AM
    Attachments:
    Snap1.png ‏4 KB

Maybe you are looking for

  • How do I know if Apple emails are real

    II'm constantly getting emails from Apple telling me my account has expired, I need to update my iTunes account, my account will be suspended if I don't update deta, etc. how do I know if this it's real? It's been going on for years and I've always i

  • PI 7.1 Performance Monitoring - Advanced Adapter Engine (AAE)

    Hi Experts, how can i use the "Performance Monitoring" from the RWB, to see all the messages (including the messages from the AAE) for a specific timeperiod? For example, i want to know how many messages go through the PI (including AAE) on one day.

  • Time capsule goes for "sleep mode" ?

    Hey Guys, Im using a Time Capsule (called TC below) 2 TB, the latest version, mostly for two things; I download files to directly to the TC harddrive and i also store some of my music on it. The first problem is that when i download files directly to

  • F110 printing Checks for Customers

    Hi All, While running F110 checks are being printed for customers who have received credit.  The client does not want checks printed for Customers, but rather wanted the customer to be credited.  How do i change F110 to ensure only payment to vendor

  • In PS Module, for setting up TECO status

    Hello, I should be able to set the status to TECO(technically completed) on an object (like WBS, Network, Activity) only when all the activities (in the relevant sub-tree of hierarchy) are "finally confirmed". I tried to put some code in BADI 'WORKOR