Using waveform element to build arrays

Hello, there,
from this forum, I learned that i can use "get waveform components" to extra time and data from waveforms.  great.  but how do i build an array and output it to a file?  does it come as a strand of arrays as it is?  or do i need to loop it so the index will shift?
if you can help and have an example...you'd be awesome!
best,
ck

If you want to create an array of timestamps, one way to do it is like in the picture attached. Using Export Waveforms To Spreadsheet File will do this for you too, if I remember correctly. I don't use the function that much.
You data is not appended randomly but whether it is correct or not, I can't say without having the actual VI to run and knowing exactly what you are trying to do.
The function Write Characters to File is probably slowing things down. If you were to look inside the function, you would thatt every time it is called, the file is opened, written to, then closed. The file opening and closing takes some time as does the actual file writing. You can put the file open and close outside the loop so that each is only done once. The time it takes to do the file writing is determined by the amount of data and the type of data. You are converting to text and that requires more bytes to store each data point. You could, save the data as binary. This will result in a smaller file and a faster write. You other option is to defer the file write until after the while loop terminates. You could wire the signal data type to the edge of the while loop and enable auto-indexing. Then, the array of signals or waveform datatypes could be written all at once.
Message Edited by Dennis Knutson on 04-17-2006 07:40 AM
Message Edited by Dennis Knutson on 04-17-2006 07:40 AM
Attachments:
Build Time Array.JPG ‏8 KB

Similar Messages

  • 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

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

  • Plotting elements from an array in waveform chart

    Hi all,
             I am trying to plot a real time data by extracting single element from an array.
    Problem is that, at some frequencies waveform chart plot perfect while at other frequencies it plots like a undersampled signals.
    Any suggestions?
    Attachments:
    wfm.png ‏136 KB
    wfm.vi ‏133 KB

    The timing information comes from the data acquisition process, not the display. You should be able to get equally good display of timing information on a chart or a graph.
    How many samples do you read at a time? How do you define "realtime"? Anything plotted on a graph or chart for the use of a human operator does not need to be updated more than about 10 times per second because the eye/mind system works at about that time scale. For humans a real time grahical update rate of 2 to 10 Hz is adequate. Then you will have 256 to ~51 new samples at each update.
    Another issue is that both your graph and your plot have plot areas which are less than 200 pixels wide. If you supply more than [plot width] pixels to a graph or chart, LabVIEW will reduce the data to determine which pixels to plot. So your graph with 1000 X-axis values has that reduced to the 184 pixels across the width of the graph. So, regardless of the precision of the data, the "precision" of the display is limited to the number of pixels.
    Lynn

  • Using a loop back node to build array okay instead of shift registers?

    Attached is a sample of how I want to accomplish appending to multiple arrays and would like an opinion wether it is acceptable or not.  I didn't want to use 12 shift registers wired from the 6 possible case structures mainly because of esthetic reasons.  Each case will be called in turn during program execution only once.  So case 0 builds it's array then later case 1 and so on.  It seems to work but frankly manipulating arrays in LV confuses me a bit.  I cannot test in the actual program since the hardware the complete program controls is not yet installed.  Your input as to the wisdom of doing this or proposing a better solution (maybe one that actually works) is appreciated
    Mike
    Attachments:
    sample2.vi ‏33 KB

    You never have more than one element in each array since you initialize the shift register with every call of the VI.
    Use "built array" instead of "insert into array", it's cleaner. However, since you only kep one elements, maybe you can jist place the scalar value inside a shift register. Make sure the default value is NaN so you know when it contains valid data.
    All you probably need is an array of fixed size (12) and replace appropriate elements as need arises.
    What you probably want is an action engine. See http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=240328#M240328
    LabVIEW Champion . Do more with less code and in less time .

  • 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

  • Can we change the property of each element of an array using property node or by other methods?

    Hello all,
    Can we change the property of the elements of an array. For example:
    I have an array of combo-boxes. Can i have such a scenario that different combo-boxes of the array will have different items to select an item.
    I am able to set the different "values" in different combo-boxes bu using "to be more specific class" property node.
    But i could not set the different item list in different combo-boxes.
    Please give me the solution.

    Thanks a million dave!!!!!
    I have learnt a very new and innovative thing...
    I just wanna ask you one more question in the above context.
    Can i have listbox or combo-box in a table just like in an excel sheet where we can have listbox by using "data validation" property for different cells having different list.Can i have this in labview. Because for this i have to super-impose the combo-boxes on the table and treat them separately.
    We have to take those combo-box values and put in table and then store it.I have attached one VI to show the scenario.
    And this is the alternative solution of the array problem which u have already given. So please suggest me between the two or any alternative solution.
    Thanks,
    Ankit Madaan
    Attachments:
    Recording _Table.vi ‏19 KB

  • Problem cycling through elements of an array using a for loop ~ error 200609?

    Hi,
    I'm outputting a 194-element array from a MATLAB script node into a for loop where the array is indexed then converted into a 8-bit boolean pattern which I'm trying to output using DAQ Assistant. I'm using LabVIEW 8.2 and a PCI 6133 DAQ using a counter(Ctr0InternalOutput) to time the output. The first element of the array goes through the loop perfectly however never makes it's way back through and throws error 200609: Generation cannot be started because the slescted buffer size is too small. Increase the buffer size. After probing the line before DAQ Assistant I confirmed only one element makes it through the loop and then throws this error? I've trying doing the same things with lower lowel DAQmx vi's using a DAQmx configure output buffer vi to override this buffer size problem, but still get the same result(not the error but same data flow problem)? Anybody know what's going on? I've included the vi's I've been working with. Thanks!
    Millie
    Attachments:
    Untitled 22.vi ‏228 KB
    Untitled 34.vi ‏180 KB

    Hi,
    I'm outputting a 194-element array from a MATLAB script node into a for loop where the array is indexed then converted into a 8-bit boolean pattern which I'm trying to output using DAQ Assistant. I'm using LabVIEW 8.2 and a PCI 6133 DAQ using a counter(Ctr0InternalOutput) to time the output. The first element of the array goes through the loop perfectly however never makes it's way back through and throws error 200609: Generation cannot be started because the slescted buffer size is too small. Increase the buffer size. After probing the line before DAQ Assistant I confirmed only one element makes it through the loop and then throws this error? I've trying doing the same things with lower lowel DAQmx vi's using a DAQmx configure output buffer vi to override this buffer size problem, but still get the same result(not the error but same data flow problem)? Anybody know what's going on? I've included the vi's I've been working with. Thanks!
    Millie
    Attachments:
    Untitled 22.vi ‏228 KB
    Untitled 34.vi ‏180 KB

  • Need to sort an object array using an element in the object.

    hi all,
    i need to sort an object array using an element in the object.can someone throw some light on this.
    Edited by: rageeth on Jun 14, 2008 2:32 AM

    [http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html]

  • How to use ni-6008 and build a four channel data acquisition at a rate of 250 samples per channel and display all the data in a waveform chart

    how to use ni-6008 and build a four channel data acquisition at a rate of 250 samples per channel and display all the data in a waveform chart 

    Hi kdm,
    please stick in one thread for the same topic!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Using Enter key from numeric keypad to enter and switch to next element in an array control

    Hello all,
    I have a question regarding a simple but annoying problem, of which I did not found a solution yet.
    I have written an application in which I have to enter data manually in a numeric array control.
    If I want to enter the value and go to the next element in the array control, i am forced to use the Tab key on my keyboard, or risk RSI using the mouse.
    How can I assign the Enter key of the numeric keypad section of my keyboard to to the same as the Tab key?
    Kind regards,
    Raymond

    [email protected] wrote:
    Can you convert the example in a image or can you convert in to 8.2.1 version?.
    Best regards
    Saved in 8.2.1 for you.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Change Array Event.vi ‏16 KB

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

  • How to average each element in an array

    I have data from a Gage Card that I would like to average.  I am tuning a laser over a 50 mA range and for each 1mA increment in current, I am taking 100 scans.  Each scan consisting of about 200 points.  I cannot average more than 10 shots using the Gagecard so I would like to capture 100 scans, and average them to reduce noise.  Currently, I have my capture vi inside of a for loop which repeats 100 times and each scan writes to a file, but I would like ony 1 scan (the lower noise averaged one) per current increment.  
    How can I average each element of 100 arrays and output this to an array?
    Thanks for the help 

    It sounds like you want to average element 0 across 100 arrays and make that element 0 of the new averaged array.  Then average element 1 across 100 arrays and make that element 1 of the new array ...   ?????
    How are you working with your 100 1-D arrays now? 
    What you should do is make a 2-D array where one dimension is 100 (for the number of individual arrays) and the other dimension is how many elements are in those 100 1-D arrays.  Then you can use for loops with auto indexing to break the 2-D array down into each row or column, do the average of that array, and autoindex on the other side to build back up into the new 1-D array of averages.  You may need to to a transpose array going into your for loop in case the arrays are indexed in the wrong direction.
    Message Edited by Ravens Fan on 01-21-2008 04:26 PM
    Attachments:
    Example_BD.png ‏6 KB

  • How to replace cluster element in an array?

    hi,
    I have understood preferable choice is to initialise array first and replace elements in an array instead of inserting new element in an array e.g. in a while loop.
    So I started to this evaluate since I have an application where I want to read lots of measurements from a txt file and display them in a XY graph. XY graph must show Y value and corresponding X value either red if it is out of range and in green if it is in range. I found a solution to do it with an array of clusters.
    In attached example I have two different methdologies represented. My problem is that upper solution doesn't display content of all measurements. Can somebody tell me what I'm doing wrong ?
    regards,
    petri
    Solved!
    Go to Solution.
    Attachments:
    plot test 3.vi ‏19 KB

    Petri wrote:
    ... using cluster with three elements was a method I found to put red and green dots in one XY graph, eg. Y=coordinateY, X(green)=NaN,X(red)=coordinateX. Perhaps there is a better way to display the data, but I couldn't find it.
    That is an odd thing and makes little sense. Why three? four, five, etc are NOT supported, so what if you want more than one color? (in range, fail high, fail low?). For more detail see the discussion here.
    In any case, reading all these values from a datafile and creating xy plots is trivial. I would recommend to use complex data. a single complex array will graph IM vs RE. For multiple plots, combine them using "build cluster array". No loops needed.
    Here's a quick draft. Of course you need to decide if the data is in columns or rows, etc. so modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    plot2XY.PNG ‏7 KB

Maybe you are looking for