Build array efficiency

Hello,
I would like to know, wheather my solution is efficient, or it can be done in a better way.
I have a mass spectrometer with a shipped labview driver and example VIs.
I want to modify one of the VI. Here the used structure of the spectrum is a kind of waveform cluster. I have attached a non funcional only-test VI, to show it. For data evaluation, I need to use XY-data pairs, so I need to create X,Y arrays from this cluster type. The size of the arrays are in the order of 10 thousends... Just in case, I will use a queue wire to do the data evaluation (consumer loop) independent of the producer loop (about 0.5 Hz data production, so every 2 sec I get a new spectrum from the MS driver).
So my question is that, is there a better way to create the XY arrays from that cluster type? Depending on the data size, in my experiance, this can be a bit slow...?
Thanks for advice!
dropbox link: (the discussion forum is not able to upload my VI... )
https://dl.dropboxusercontent.com/u/8148153/test1.vi
Solved!
Go to Solution.

I agree with the ramp function being a bit more efficient, but I am not sure about replacing array subset for building sequential numbers. I would be interested to learn if it was otherwise.
The following post seems (I agree is old) seems to back up my understanding. I also did a quick benchmark and it seems to back my belief
http://forums.ni.com/t5/LabVIEW/create-an-array-of-consecutive-integers/td-p/127751
Beginner? Try LabVIEW Basics
Sharing bits of code? Try Snippets or LAVA Code Capture Tool
Have you tried Quick Drop?, Visit QD Community.

Similar Messages

  • Build array or merge signals?

    I know there are more than one way to merge waveform signals to display them in a waveform chart. The two I know are merge signal express vi and build array. But I was wondering which one of the two were more efficient. I once read somewhere in this discussion forum that "build array" is one of the more time consuming tasks.
    Not very critical to what I am doing (a loop of data acquition takes just a few milli seconds with build array) but was just wondering if one or the other was a better way to do it. Or there might both be the same.
    Thanks.
    Solved!
    Go to Solution.

    Whenever the size of a data structure changes, a new memory allocation needs to be made. It does not really depends on what primitive you use.
    Do the sizes actually change with each iteration or does the final size remain constant and you are just merging inputs of constant size?
    LabVIEW Champion . Do more with less code and in less time .

  • Error in file export when order of elements in build array changes

    Hi everyone,
    A while ago I wrote a vi file which does the following:
    At first it initializes a camera and chooses a region of interest (ROI). Data out of the ROI will be discarded.
    Then it raster scans a motor stage in x and y direction, in bidirectional mode (meaning that x alternates between scanning from left to right and right to left as y is inreased).
    For each point of the scan, the spectrum is collected, which is then integrated in lambda to give an idea of the total intensity.
    Then the intensity is plotted, along with the spectrum at each point.
    The final results are exported in a text file.
    The problem:
    If I flip the order of the wires in the "build array" before the file export, placing the Total Count (intensity) wire in place of the Spectrum wire, the file export fails. What I mean by "fails" is that the .txt file contains characters that look like chinese!
    Why is that?
    I attach my .vi as well as two screenshots which demostrate the problem.
    Solved!
    Go to Solution.
    Attachments:
    correct.png ‏182 KB
    Wrong.png ‏180 KB
    1.7z ‏119 KB

    mikeporter wrote:
    Hey Jeff... The changes you recommend are all good (and necessary) but the thing I'm stuck on is that regardless of what happens to the floating point data, there's that built-in VI that changes it to string representations of the numbers. And as I understand it, that is where the problem is.
    Mike...
    PS: Coming to NI Week?
    Not this year
    What scared me was the sgls on a SLs with no wire branch to force a data copy which, would force LabVIEW to preserve the sgls since the SL might need to be used again then, they get all mixed up building arrary out of mixed coerced sgls and dbls.  With the potential of a miss-reussed buffer (not uncommon in 2011) confusing the string operations in the write to spreadsheet.   The problem of course, must exist outside of write to spreadsheet file since it only exhibits with a build array element order change.  Or, we all are halucinating (Possible alternate theory)  
    Jeff

  • 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.

  • Is it possible to create a 1 D array with the "build array VI"? when receiving random number

    Hello all,
    Is it possible to create a 1 D array with the "build array VI" when receiving random number?
    I am receiving random data and the build array VI always create a 2D array which might cause some problem if you want to compute certain type of operation after.
    Any example will be welcomed.
    Thank you,
    Israel 

    Hello Lynn and Yamaeda
    First I want to Thank you Lynn for your linguistic contribution indeed "Build Array" is a primitive and not VI, thank you for the education. In reality what I am doing is simple.
    I have two arrays of complex elements Array1 and Array2.
    Array1 conains the complex elements ""(a0+ib0) ; (a1+ib1) ;...(an+ibn) ;
    Array2 conains the complex elements ""(c0+id0) ; (c1+id1) ;...(cn+idn) 
    What I want to do is the multiplication of the first array by the  conjugate of the second array element.
    Array1*(Conjugate Array 2)" for the first element the results is "(a0.C0-b0.d0) + i(b0c0-a0d0)" and the etc...
    and then taking the square root ([(a0.C0-b0.d0) power of 2]) +  [(b0c0-a0d0) power of 2])
    I was wondering if there were some dedicate primitive that could solve the computation above which is the cross correlation in Frequency domain.
    Thank you very much.
    Israel

  • 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 .

  • Problem with building array inside a case statement

    I have a problem with my build array.
    Iam trying to construct a build array when ever I see a new element in my parent array during run time.
    Using shift registers, search array and If- case structure, inside a while loop. Iam implementing this logic (I dont want to use Event structure).
    Iam able to achieve most part of it, but have a problem with the first element. Except the first element of my parrent array, every thing is appending in to the build array. Can any one look at my vi and suggest me what Iam doing wrong here.
    Thank you
    Attachments:
    debug.vi ‏12 KB

    I think you need to replace the tunnels (carrying the array) in the for loop with a shift register.
    Lynn

  • Build Array keeps name of the last element but not the others. Workaround?

    Hi there,
    Sorry if this has been posted before, I did the search first but did not find anything.
    Problem is that I have two setups that are identical and need to be controlled from a single vi. Since they are the same they are configured with the same sets of parameters so I decided to create a cluster of these and then build an array of the clusters. This way I need to only use one wire and if I need a given parameter I can easily get it from there (or so I thought) and also since I need to see if anything changes I can compare one wire instead of each one of the parameters.
    The gui has the list of parameters then in the block diagram I bundle them appropiately, using "Bundle by Name" and then each bundle into an array using "Build Array". Problem arises when I index the array for the first setup and the use that to unbundle the parameters I need, using "Unbundle by Name" (though if I use "Unbundle" the same happens)and lo and behol, the ouput names are from the second setup, not the first.
    Here is the curious thing though, even though the names are all wrong the values are correct. I could live with this but it is annoying plus it will make another user very hard to understand the diagram plus this is just a proof of principle to test with two, eventually there will be eight or even more and that is going to get really confusing.
    Is there a way around this? Even if it is to change the names after unbundled.
    Check the attached vi to see what I mean.
    Solved!
    Go to Solution.
    Attachments:
    Test Build Array Names.vi ‏11 KB

    I think you are forgetting an important point about arrays.  The only thing that can be different between each element of an array is its value.  The array elements must all share the same properties.  So that would include the names of the individual elements that make up the cluster that is an array element.
    It appears that the last cluster that gets built into the array is the one that defines the names of the elements that are within the cluster element.  You either need to give all elements of the array the same names within the cluster.  Or use a cluster of clusters instead of an array of cluster to build your data structure.

  • 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.

  • Build array out of memory

    Need help im new to labview im posting very simplified example of code over a few hours im getting out of memory error normaly this would be sensor data being colected every 2-4 sec and writen to a csv file. 
    Attachments:
    build array example.vi ‏19 KB

    If you dramatically speed up the loop (e.g. remove all waits), you will obviously run out of memory in the queue because you generate numbers much faster than they can be written to disk. You need to ensure that the generation rate is less than the average maintainable speed of the disk IO.
    Using write to spreadsheet file is also a low performance option, because of the constant file open/close operations and all the formatting steps. If speed matters, use a binary file and low level file IO. Open it once before the loop, and just append inside the loop. Close it when the loop ends.
    Maybe you should set an upper size limit for the queue?
    I don't have the ogtk subVI, but here's how your code could be simplified (not showing the file IO suggestions). The browse option for the file controls also should be "new or existing".
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    build array example_MODCA.vi ‏10 KB

  • Build array combinations

    Hi
    i have a 2 d array set of values with n columns and rows .
    I need to build array with all the cell combinations . 
    Can u pls guide me with an example vi ?
    Thanks

    hi nithyamv
    I need to build array with all the cell combinations     Can u brief your query little bit more ,
    by giving screen shot. or .vi you developed.  
    Indrajit
    | [email protected] | [email protected] .

  • Build Array forces Concatenat​e Inputs

    I have a VI attached that I'm having problems with the Build Array function. With a certain 1D extended array called Frequency (Hz), when I wire it to a Build Array with another 1D extended array, it puts out a 2D array. However, when I divide that second 1D extended array by a single extended constant (20), and try to wire it to the Build Array, the Build Array changes to "Concatenate Inputs" and will not allow me to change it back. These are two 1D arrays, I should be able to make a 2D array out of them.
    What am I missing here? I know this sounds like an elementary problem (hopefully it is), but I couldn't figure it out. Please see the VI and follow the statement on the Block Diagram. Could it be something with the inheritance properties?
    Michael
    Attachments:
    SavePassFailCriteriaSUB_test.vi ‏51 KB

    Probably related to the bug discussed recently here:
    http://forums.ni.com/ni/board/message?board.id=170​&message.id=294807
    LabVIEW Champion . Do more with less code and in less time .

  • 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.

  • Build Array Question

    Hi,
    I am wondering how to build a selective array from a continually changing stream of data. For example in the attached picture, I wish to append to the array only even numbers. So the resulting array should be [2 4 6...]. However, I am aware that for a case structure, an output terminal is required, so instead my output reads [0 2 0 4 0 6...], since the default value in the false case is zero. Is there a way to build an array that will only append new elements when certain conditions are met? (in this case, the condition being if the number is even).
    I am aware that you can use a sort array function block, then remove the zeros. Is there a better way to perform this task that I need? In my actual program, I need to record the value of the time at a couple values at the turn of the hour when certain conditions are met, then feed the new array to a graph. Thanks,
    Adam
    Attachments:
    Build an Array.JPG ‏31 KB

    You can just put the build array part into the case statement.
    You can also switch the build array to concatenate inputs mode (right
    click on it), and use arrays to output from your case statement (using empty
    arrays when you don't want to add anything)
    Ideally you avoid puting build array into a loop, since reallocating large arrays can really slow down a program (shouldn't be a problem for small arrays).
    Message Edited by Matt W on 11-21-2006 08:27 PM
    Message Edited by Matt W on 11-21-2006 08:28 PM
    Attachments:
    build array 1.PNG ‏15 KB
    build array 2.PNG ‏15 KB

  • Build array element labeling

    Hello,
      I am using the build array function to make a large boolean array. How can I have the element positions labeled so that I can easily determine what bit in the array I am connecting to?
    Regards,
    Kaspar
    Regards,
    Kaspar

    You didn't mention that in your problem statement.  Also, you mentioned you're using Build Array.  Are you interested in knowing the terminal position on the Build Array that you're wiring to?  There is currently no way to do that, as they all have a name of "element" when you hover over the Build Array with a tip strip.  How many values are you wiring to your Build Array, anyway?  If there are so many that you can't keep them straight without labels, perhaps there's a more elegant way to deal with the code?
    If not, though, perhaps you could include a decoration on the diagram separating every 5th element that could help you more easily determine what position you're at with the build array:
    -D
    Message Edited by Darren on 05-23-2007 03:09 PM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    build_array_dec.png ‏9 KB

Maybe you are looking for

  • Sending Data Requests - System Monitoring - SAP Library

    To add a comment, please log in or register on the top of this page and choose Reply. Please write your comment in English. You can also go back to the SAP help page.

  • Cntrl T yields a page with yahoo rather than a blank page

    When I press control T to get a new page, instead of a blank page opening, the page opens with the yahoo search bar already in place. I really do not want to use yahoo and would rather see a blank page as was the case previously. I probably dl's some

  • Alguien me puede ayudar a recuperar mi ID de Icloud??

    Instalando la actualizacion de iOS  Al reiniciar mi dispositivo se me blokeó pidiendome q ingrese mi ID de activacion de mi iPhone. Sinceramente no me recuerdo. Pero mis otras cuentas ID de Apple en la pagina oficial de Apple si ingresan. Necesito ay

  • Recording software

    Please, someone... what is a good audio recording software to use on an intel MacBook with a Firepod? And don't say GarageBand, please... GarageBand is cute and all, but I want something a bit more professional... Situation is this: Got MacBook as a

  • Prepaid users: Choosing between mini SIM, micro SI...

    I'm thinking of getting a new prepaid card recently, and am having a trouble deciding between the usual mini-SIM and micro-SIM, both offered by my telco. For prepaid users, we don't really visit the telcos to recontract every 1 or 2 years and get a n