DirectReports Array inside of another Array

So i am trying to make this directReports Array to parse into the CSV, but i cant get the syntax right. Can anyone help here?
function Release-Ref ($info) {
foreach ( $p in $args ) {
([System.Runtime.InteropServices.Marshal]::ReleaseComObject(
[System.__ComObject]$p) -gt 0)
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
$olFolderContacts = 10
$objOutlook = new-object -comobject outlook.application
$n = $objOutlook.GetNamespace("MAPI")
$colContacts = $n.GetDefaultFolder($olFolderContacts).Items
$xl = new-object -comobject excel.application
$xl.Visible = $True
$wb = $xl.Workbooks.Add()
@{ directReportsExp = 'directReports'; Expression = { $_.directReports -join ';'; }; }
$ws = $wb.Worksheets.Item(1)
$ws.Cells.Item(1, 1).Value() = "First Name"
$ws.Cells.Item(1, 2).Value() = "Last Name"
$ws.Cells.Item(1, 3).Value() = "Manager"
$ws.Cells.Item(1, 4).Value() = "Directly Reports to"
$ws.Cells.Item(1, 5).Value() = "Job Title"
$ws.Cells.Item(1, 6).Value() = "E-mail Address"
$i = 2
foreach ($c In $colContacts) {
if ( $c.Email1DisplayName -ne $Null ) {
$email = $c.Email1DisplayName.Split( '(' )
$ws.Cells.Item($i, 1).Value() = $c.FirstName
$ws.Cells.Item($i, 2).Value() = $c.LastName
$ws.Cells.Item($i, 3).Value() = $c.ManagerName
$ws.Cells.Item($i, 4).Value() = $c.directReportsExp
$ws.Cells.Item($i, 5).Value() = $c.JobTitle
$email = $email[1].TrimEnd( ')' )
$ws.Cells.Item($i, 6).Value() = $email
$i++
$r = $objWorksheet.UsedRange
$r.EntireColumn.Autofit
$a = Release-Ref $r $ws $wb $xl

Have you tried Export-Csv? I can't comment on the syntax for the excel com stuff as it's something I never use, but Export-Csv is built in and works well to output Powershell objects to a csv file.
You're doing quite a bit in the function - you might want to do less. You should just output the objects you need and then you can process those in the pipeline. For instance:
[PsCustomObject]@{
'First Name' = $Contact.FirstName
'Last Name' = $Contact.LastName
'Manager Name' = $Contact.ManagerName
'Directly Reports To' = $Contact.directReportsExp
'Job Title' = $Contact.JobTitle
'E-mail Address' = $Email
This will output an object that can be piped to export-csv:
Release-Ref | Export-Csv -Path c:\directreports.csv -NoTypeInformation
Also, there are definitely some things you should do differently in the function itself. Why not fully parameterize the function instead of using $args? This tutorial may help:
http://channel9.msdn.com/Series/advpowershell3/04

Similar Messages

  • Making array while looping another array

    hi all,
    i have an array of int values.
    i need to make a list of another values while looping around the int values.
    but the values that are added to the list are objects
    can any one help me with the sample code in getting the list
    any ideas?
    regards and thanks in advance

    Double-posted
    http://forum.java.sun.com/thread.jspa?threadID=648140

  • How to Average an Array based on another Array?

    Example:
    I have ARRAY1 with the following:
    1
    1
    1
    2
    2
    3
    ARRAY2 Contains:
    1
    2
    3
    4
    5
    6
    In the end ARRAY3 would contain:
    2                  (1+2+3)/3
    4.5               (4+5)/2
    6                  (6)/1
    Solved!
    Go to Solution.

    Here is my first go at it.  There are plenty of improvements that can be made (conditional index is one) but it appears to do what you want.  Array 1 and 2 must be the same size for it to work.
    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.
    Attachments:
    Average Array of Array.vi ‏13 KB

  • Array inside another array

    hi guys
    is it posible to place one array inside another array?
    something like
    public double[] dblarray(int n)
    double [] dbl2 = new double(n)
    return dbl2;
    public double[] dbl2array(int m,int n)
    int n=10
    double [] dbl2 = new dobule[m];
    for(int i = o;i < m ; i++)
    dbl1=dblarray(n)
    if tryed it an it told me its wrong. does any one know how to do it or if it is posible since i come from ansi c i know this is posible in c but is it in java???
    pleas help:)
    thanks
    jeliel

    No, it's not possible in a strict sense. Java is more type safe than C - in C there is no real array type...
    What you can have is an array of references (=pointers) to arrays of doubles, or double[][], and what your code does is more commonly written asdouble[][] dbl2 = new dobule[m][10];

  • Trying to clear an array inside a case structure

    Good morning all.  I am trying (unsuccessfully, obviously) to clear an array inside a case structure.  (See case structure at right side of vi, I colored it green to make it easy to find).  Here's (briefly) what I'm trying to do.  I have 6 test probes in the process.  All six probes are connected to the Alcatel Detector through a 6-solenoid manifold.  As I run the test, I want to sample 1/second, for let's say 3 minutes.  For the first 30 seconds, I want to pull a sample from from probe 1, so I turn on solenoid one and leave it open for 30 seconds.  Now all 30 values are tagged as having come from Probe 1, and they're stored in array 1.  I can now compute an average value for probe 1. Then I close solenoid 1 and open solenoid 2, saving the next 30 values to array 2.  (and so-on, until I have measured all 6 probes for 30 seconds each).  Then I wait a pre-determined amount of time and repeat the process.  Here's my problem.  I want to clear out each array as I begin the second iteration, so that I can easily compute the average of the last 30 values.  If I initialize the array by connecting a constant 0 to the shift register on the for loop insid ethe case structure, it does not work, nor does it work to place the 0 outide the overall for loop (the next for loop going out, NOT the OVERALL for loop).  I know my programming skills are still crude, but I'm putting everything into this.  Anyone have any suggestions? 
    Attachments:
    HCMF rev 1 25 Apr.vi ‏485 KB

    Altenbach, I definately understand your approach, and I like it much better than my own.  But I still have no luck making it work.   I get the same result as before (my original attempt).  Value 0 of the array simply changes each iteration, with nothing "saved".  Each new value simply overwrites the last value.  Can you take a look at my new vi, with changes, and see if you can find the error of my ways.  I am but a rookie Jedi in the vast reaches of LabVIEW Space, and you are no doubt a Jedi MASTER
    Attachments:
    HCMF rev 1 25 Apr pm.vi ‏374 KB

  • Array inside getURL not working

    I'm trying to put links on multiple images using the titles of the images that I keep inside an array
    var imagesTitles = new Array("Image title1", "Image title2", .... ); 
    I'm starting a for loop here and after I replace the empty spaces with hyphens and lowercase the image titles I'm trying to attach a link to every instance like this:
    getURL(imageLinks[i], "_blank");
    If I trace imageLinks it looks like this http://www.mysite.com/image-title
    The browser opens and I get http://www.mysite.com/undefined
    What would be the correct way to use getURL with an array?

    Here is my code:
    String.prototype.replace = function(s, r) {
        return this.split(s).join(r);
    for (var i:Number = 0; i < imagesTitles.length; i++) {
    imageLink[i] = imageTitles[i];
    imageLink[i] = imageLink[i].replace(" ", "-");
    imageLink[i] = imageLink[i].toLowerCase();
    imageLink[i] = "http://www.mysite.com/" +imageLink[i] + "/";
    trace (imageLink[i]); // trace here shows a list of valid urls
    gallery_mc["image" + i.toString()].onRelease = function(){
    trace (imageLink[i]); // trace here shows undefined
    getURL(imageLink[i], "_blank");
    Must be a scope problem but I just started using AS2, I don't know how to fix it.

  • How to build a cluster array dynamically from another cluster array?

    I'm working on a problem where I seem to be getting lost in a sea of
    possibilities, none of which strikes me as optimum. Here's what I need to do.
    I've got an input array of clusters (ARR1). Each cluster contains the
    following components: an integer (INT1), a ring variable (RING1), a boolean
    (BOOL1) and a cluster which itself is simply a bunch of ring variables
    (CLUST1) Now, I need to transform that into a set of clusters (CLUST3) each of
    which contains an array of characters (CHARARY2), a copy of the ring variable
    (RING2), a copy of the boolean variable (BOOL2) and a copy of the cluster
    (CLUST2).
    To build the CLUST3, I need to find all elements within ARR1 that have the
    same unique combination of RING1 and BOOL1, and if BOOL1 is True, then RING1
    in addition, build an array of all the INT1 values corresponding to each
    unique combination above converted to character, and then bundle this array
    plus the unique combination of the other variables into a new cluster. In
    general I could have several such clusters.
    So if I had the following array to start with:
    Index INT1 RING1 BOOL1 CLUST1
    0 3 1 F {Values1}
    1 2 1 T {Values2}
    2 4 0 F {Values1}
    3 6 0 F {Values3}
    4 1 2 T {Values2}
    5 4 2 T {Values2}
    6 3 0 T {Values3}
    7 4 2 T {Values3}
    I should end up with the following clusters:
    CHARARY2 RING2 BOOL1 CLUST1
    "3" 1 F Don't care
    "2" 1 T {Values2}
    "4","6" 0 F Don't care
    "1","4" 2 T {Values2}
    "3" 0 T {Values3}
    "4" 2 T {Values3}
    What methods would you suggest for accomplishing this easily and efficiently?
    Alex Rast
    [email protected]
    [email protected]

    Tedious but not conceptually difficult.
    ARR1 goes into a for loop, auto indexed on the FOR loop. The for loop has a
    shift register which will be used to build the output array. Nested within
    the for loop is another for loop, which the shift register array goes into,
    again auto indexed, along with the element that has been auto-indexed from
    ARR1. This for loop has a shift register, initialised with a boolean "true".
    The inner loop compares the current element of ARR1 with the output array
    and if an element in the output array is already present which matches the
    input by your criteria, then the boolean register is set false; otherwise it
    is left alone.
    After the nested FOR loop you have a case fed from the boolean shift
    register; if the boolean is true, the new element is unique and should be
    added to the array. If it is false then a previous element has been found
    making the present one redundant, and the array should be passed through
    without adding the element.
    In the true case, you simply unbundle the original element into its
    components and build the new element, using "build array".
    Notes for if the above is easy for you;
    1) if handling lots of data then pre-initialise the shift register of your
    outer loop with the same number of elements as your input array. Use
    "Replace Array Subset" instead of "Build Array" to insert the current
    element into the pre-allocated memory rather than having to create a new
    array and copy all the current data across, which is what "Build Array" is
    doing. Use "Array Subset" at the end to obtain a new array containing just
    the elements you've used, removing the unused ones at the end.
    2) Again for large datasets- the use of a while loop instead of the inner
    for loop is more efficient since you can halt the while loop as soon as a
    duplicate is found. With the described approach you have to go through the
    whole array even if the first element turns out to be a duplicate- much
    wasted computer time.
    Alex Rast wrote in message
    news:[email protected]...
    > I'm working on a problem where I seem to be getting lost in a sea of
    > possibilities, none of which strikes me as optimum. Here's what I need to
    do.
    >
    > I've got an input array of clusters (ARR1). Each cluster contains the
    > following components: an integer (INT1), a ring variable (RING1), a
    boolean
    > (BOOL1) and a cluster which itself is simply a bunch of ring variables
    > (CLUST1) Now, I need to transform that into a set of clusters (CLUST3)
    each of
    > which contains an array of characters (CHARARY2), a copy of the ring
    variable
    > (RING2), a copy of the boolean variable (BOOL2) and a copy of the cluster
    > (CLUST2).
    >
    > To build the CLUST3, I need to find all elements within ARR1 that have the
    > same unique combination of RING1 and BOOL1, and if BOOL1 is True, then
    RING1
    > in addition, build an array of all the INT1 values corresponding to each
    > unique combination above converted to character, and then bundle this
    array
    > plus the unique combination of the other variables into a new cluster. In
    > general I could have several such clusters.
    >
    > So if I had the following array to start with:
    >
    > Index INT1 RING1 BOOL1 CLUST1
    > ---------------------------------------------------
    > 0 3 1 F {Values1}
    > 1 2 1 T {Values2}
    > 2 4 0 F {Values1}
    > 3 6 0 F {Values3}
    > 4 1 2 T {Values2}
    > 5 4 2 T {Values2}
    > 6 3 0 T {Values3}
    > 7 4 2 T {Values3}
    >
    > I should end up with the following clusters:
    >
    > CHARARY2 RING2 BOOL1 CLUST1
    > -----------------------------------------------------
    > "3" 1 F Don't care
    > "2" 1 T {Values2}
    > "4","6" 0 F Don't care
    > "1","4" 2 T {Values2}
    > "3" 0 T {Values3}
    > "4" 2 T {Values3}
    >
    > What methods would you suggest for accomplishing this easily and
    efficiently?
    >
    > Alex Rast
    > [email protected]
    > [email protected]

  • Bit permutation inside a byte array

    Hi everyone,
    I'm trying to implement DES algorithm, i want to permute specified bits inside an 8byte array.
    I tought about extract every bits from the byte array inside a 64 byte array and then do the permutation.
    But i don't see how to put these bits back into an 8byte array to return the result of encryption/decryption.
    This is what i've done so far (inspired by sources i found on the internet) :
    // extends 8 byte array into a 64 byte array
    public static byte[] extendsByteArray(byte[] bytes) {
    byte[] tab = bytes;
    short len = (short)(desBlockSize * (short)8);
    byte[] bits = new byte[len];
    short i,j;
    for (i = (short)(desBlockSize - (short)1); i >=0; i--) {
    for (j = (short)0; j < desBlockSize; j++)
    bits[--len] = (byte) ((tab[i] >> j) & 0x01);
    return bits;
    // 64 byte array to 8 byte array
    public static byte[] transformByteArray(byte[] bits){
    byte[] tab = bits;
    byte[] bytes = new byte[desBlockSize];
    short i,j = (short)0;
    for ( i = (short)0; i < (short)8; i++){
    bytes[i] = (byte)((bits[j] * (short)2^7) + (bits[j+(short)1] * (short)2^6)+
                   (bits[j+(short)2] * (short)2^5) + (bits[j+(short)3] * (short)2^4)
                   + (bits[j+(short)4] * (short)2^3) + (bits[j+(short)5] * (short)2^2)
                   + (bits[j+(short)6] * (short)2) + (bits[j+(short)7]));
    j +=(short)7;
    return bits;
    This implementation doesn't seems to work, do u have some ideas why it doesn't work or is there an easier solution to permute bits as i'm stuck with this fo the moment.
    Thanks in advance for your answers,
    Julien

    If you are using JavaCard please do not use multiplications as you used in your code. Integer multiplications are very slow in any platform that does not implement them in hardware, and the virtual machine that runs in JavaCards usually does not do any optimizations or Just-In-Time compiling - simply interprets the codes. Memory and CPU power are at a premium in Java Cards. Even if your Java Card has a hardware multiplier, usually it is reserved for RSA operations - it is not available for general use for Java programs.
    Instead of using x * 2 raised to the sixth power, use x << 6. It is faster and generates fewer bytecodes.

  • How to build an array inside a loop

    Hi everyone,
    I have a basic question about labview. I would like to create an array in a "for" loop in that way:
    inside the loop, if a condition named "A" is verified, then, i add a new value to the first column of the array.  Otherwise, i create a new column, and start to add values to this column when the condition "A" is verified, etc.
    I put an example of a VI where the condition "A" is "the increment of the loop + 1 is not divisible by 5" and the values of the arrays are the increment of the loop + 1. The loop stops when the increment = 25.
    In this example, i have a single column with the values [1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21 22 23 24]
    while I would like to have an array of 5 columns:
    1   6   11   16   21
    2   7   12   17   22
    3   8   13   18   23
    4   9   14    19   24
    Note than this is just an example. More generally, the array can contain columns of different lengths.
    Thanx for your answer
    Andrew
    Solved!
    Go to Solution.
    Attachments:
    build_array.vi ‏9 KB

    You can't have columns in an array have different lengths - you can dynamically increase the size of the array (e.g. build array) but it means you will get the default value of the array in the other columns up to the new size of the array (normally 0).
    You will need to either keep track of the last index you wrote to for each column so you can trim it later or put an array in a cluster and then create an array of those (an array of a cluster of an array) - that will allow your column data array to have different lengths and you'll just need to unbundle/bundle the array before adding new items.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • How can I add a new row into an array bases on a1D array

    Hello,
    I build a FieldPoint application with LabView 7.1 RealTime. I've a measurement loop with 1Hz sample rate. I sample 5 channels and put them into a 1D array. Presently I write directly to a cvs file but this I've to cahnge because my loop slows down to 0.2 Hz.
    I want to sample my data the hole day (86400 loops) and save them inside of an array. When the time is over I want write the hole array (table) to the file.
    How I can do this or hoow I can add my 1D array to a new row in my 2D array?
    Thanks
    Thomas
    Thomas

    TomDooley wrote:
    Hello,
    ...I write directly to a cvs file ...my loop slows down to 0.2 Hz
    Writing a series of 5 values to a file should not take so long. There is probably something wrong in the way you are saving your data. May be you should post a simplified version of your vi, so we could see how to improve your code.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Variable number of two dimensional arrays into one big array

    I have a variable number of two dimensional arrays.
    The first dimension is variable, the second dimension is always 7.
    i.e.:
    Object[][] array0 = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    Object[][] array1 = {
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Object[][] arrayi = ...I'm generating these arrays with a for-loop:
         for (int i = 0; i < filter.length; i++) {
              MyClass c = new MyClass(filter);
              //data = c.getData();
    Where "filter" is another array which is filled with information that tells "MyClass" how to fill the arrays.
    "getData()" gives back one of the i number of arrays.
    Now I just need to have everything in one big two dimensional array.
    i.e.:Object[][] arrayComplete = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Any idea on how to accomplish this? It's blowing my mind right now.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Just brainstorming here:
    Why not put your actual data in a class and store that in a LinkedList (so you know the total number of elements for your multi-dimensional array). Then initalize your multi-dimensional array and populate it? Haven't tested the following, but thinking something along the lines of
    public class MyData {
         //data here
         public Object[] toArray() {
              //something similar to this
              return new Object[] = {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"};
    LinkedList<MyData> data = new LinkedList<MyData>();
    data.add(mydata1);
    //however many times you need
    Object[][] arrayComplete = new Object[data.size()][7];
    for(int i = 0; i < data.size(); i++) {
         arrayComplete[i] = data.removeFirst().toArray();
    }Another option for knowing how many rows you would need might be using something like:
    int rows = 0;
    rows += array1.length;
    rows += array2.length;
    //etc...But is not entirely useful if you don't know how many variable arrays you have (although reflections might help if the name of the array variable is incremented systematically, someone told me earlier to avoid reflections since it could make debugging a LOT more difficult).
    Edited by: bogdana on Apr 1, 2010 10:38 AM

  • How to get the array with in the array in plsql?

    Hi,
    I have a table contains the data like below strcture.
    LINE_NUMBER     TAG_NUMBER     NOTES     TORQUE_1     TORQUE_2     TORQUE_3
    1          SSS          SUCCESS     2000          3000          4000
    1          SSS          SUCCESS     4000          5000          6000
    1          SSS          SUCCESS     7000          4000          8000
    2          YYY          FAIL     200          300          400
    2          YYY          FAIL     400          500          600
    2          YYY          FAIL     700          400          800From the above table data line_number, tag_number and notes are the commom values for the particular line number. If you see the line number 1, we have three records torque values with different torque values for one line number. Now i have to create a stored procedure to store the line_number, tag_number and notes in one array then remaining torque column for another array. The output should be the below. The output will be for line number 1 is for array1 and remaining torque values for that lin number is another array2. The same line number 2 is will come in array1 and torque information of line number 2 is for another array2. This will be structure.
    Array_1 Count :2
    Array_2 Count :6
    1: LINE_NUMBER: 1: TAG_NUMBER: SSS, NOTES: SUCCESS
    1: TORQUE_1:2000, TORQUE_2:3000, TORQUE_3:4000
    2: TORQUE_1:4000, TORQUE_2:5000, TORQUE_3:6000
    3: TORQUE_1:7000, TORQUE_2:4000, TORQUE_3:8000
    2: LINE_NUMBER: 2: TAG_NUMBER: YYY, CUST_NUMBER: FAIL
    1: TORQUE_1:200, TORQUE_2:300, TORQUE_3:400
    2: TORQUE_1:400, TORQUE_2:500, TORQUE_3:600
    3: TORQUE_1:700, TORQUE_2:400, TORQUE_3:800Can anyone share with your thoughts?
    Thanks
    Edited by: orasuriya on Jul 10, 2009 10:33 AM

    Not sure why you need pl/sql
    WITH YOUR_TABLE AS
    SELECT 1 LINE_NUMBER, 'SSS' TAG_NUMBER, 'SUCCESS' NOTES, 2000 TORQUE_1, 3000 TORQUE_2, 4000 TORQUE_3 FROM DUAL
    UNION ALL
    SELECT 1,'SSS','SUCCESS',4000,5000,6000 FROM DUAL
    UNION ALL
    SELECT 1,'SSS','SUCCESS',7000,4000,8000 FROM DUAL
    UNION ALL
    SELECT 2,'YYY','FAIL',200,300,400 FROM DUAL
    UNION ALL
    SELECT 2,'YYY','FAIL',400,500,600 FROM DUAL
    UNION ALL
    SELECT 2,'YYY','FAIL',700,4000,800 FROM DUAL
    SELECT     DECODE (rn, 0, line_number, rn) || ':',
               col_val3,
               col_val2,
               col_val3
    FROM       (SELECT   0 rn,
                         line_number,
                         tag_number,
                         notes,
                         'LINE_NUMBER:' || line_number col_val1,
                         'TAG_NUMBER:' || tag_number col_val2,
                         'NOTES:' || notes col_val3
                FROM     your_table
                UNION
                SELECT   ROW_NUMBER ()
                           OVER (PARTITION BY line_number, tag_number, notes
                                 ORDER BY ROWNUM
                         line_number,
                         tag_number,
                         notes,
                         'TORQUE_1:' || torque_1,
                         'TORQUE_2:' || torque_2,
                         'TORQUE_3:' || torque_3
                FROM     your_table)
    ORDER BY   line_number, tag_number, notes, rn

  • To make one larger array using other two arrays

    Hi,
    I have two one dimensional arrays, using these two arrays as index need to create another larger one dimensional array.
    like : if two one dimensional arrays namely X and Y, then X and Y should go as index for the final array.
    Please help.
    Thank you

    kathyayini wrote:
    I have two one dimensional arrays, using these two arrays as index need to create another larger one dimensional array.
    like : if two one dimensional arrays namely X and Y, then X and Y should go as index for the final array.
    Please help.I second jverd, but you might want to look at Arrays.copy() and System.arrayCopy().
    Winston

  • Replace build array with replace subset array

        Currently I am using a build array function, but would like to replace it with a replace array subset, but I am new to labview and having a lot of trouble.  I've attached a screen shot of the code I am struggling with.  Does anyone have any ideas?
    Attachments:
    Build array code.JPG ‏29 KB

    First, I'm assuming this is inside some sort of loop.  Second, I would recommend cleaning up the code a bit so the feedback node is not overhanging the edge of the case structure.  It's unclear as to what is wired to what.  Third,  I would recommend using shift registers instead of the feedback node.
    Fourth, and the main thing is that you are currently initializing a 64 element 1-D array and appending it to your array on every iteration with the build array.
    If you want to use the replace array subset.  Initialize the array to the size you want outside of the loop.   Feed it into the left hand shift register.  Replace each row (or column) with your new data.  You will need to track the iterations, and possibly add special code to shift the array, or enlarge the array in the event you have more data come in then the original size of your array.

  • Memory/Speed of Split 1D array vs Delete from array

    Just wondering how Split 1D array works - does it create two new arrays in a new section of memory or does it just split the existing array in two, reusing the memory in place. (assuming that the original array is not needed elsewhere). If the latter is the case then presumably it is more efficient to use split array than delete from array if I want to remove element(s) from the beginning or end of the array. Is there a speed advantage as well?
    If I use split array but don't then use one of the output arrays is that memory deallocated or does the array remain in memory?
    Thanks
    Dave

    Ok please ignore the results I posted earlier, they are rubbish - not least because I got the column headings mixed up but also because my code was full of bugs
    So, here is a revised table, and the code - which hopefully only contains a few bugs... I'm not clued into benchmarking yet so please feel free to rip the code apart.
    I still get different results depending on where in the array I split it, most noticeably with subset and reshape. There is no effect with split. I'm guessing this is to do with the memory allocation. (I have not preallocated memory in my code, but I did wire the output arrays to Index Array)
    Message Edited by DavidU on 08-12-2008 04:49 PM
    Attachments:
    Benchmarks 2.png ‏13 KB
    split array test.vi ‏25 KB

Maybe you are looking for