Initialise waveform array of 10 elements

Hi all,
I would like to create an array of 10 waveform datatype constants to pass into a structure.  Once passed in, 9 of these elements will be extracted and then another added after which the new 10 will be graphed.  Hopefully this will effectively create a continuously updating graph of my data.
I was wondering if anyone knows how to create a 10 element array using waveform datatypes.
I look forward to the great help I have received so far.

Hi,
The charts are a bit limiting as I would like to see the grid lines so that values can be directly read from the graph.  What I am trying to do is to acquire some data from a liquid nitrogen tank we have and then display it on a graph so that we can see the last four days usage.  This is important for us as if we run out our experiments will fail.
The only way I can think of doing this is to create a 10 element array and feed it through a shift register into a while loop.  Inside the loop the array will be cut to 9 elements using the subset array function and then the new data point that is acquired will be added to the array.  This would make the new array one point different each time.  Each time the array is appended it would be redrawn effectively showing a continuously acquiring graph.  The obviously the shift register would feed the new array back into the beginning and it would update again.
I have tried many iterations but there always seems to be a problem.

Similar Messages

  • Need advise for processing DAQmx waveform array

    Hello All,
    I am using following code to continuously acquire data from 2 channels, then export to a text file for analysis with Execel or Origin. The data file should contain four columns:
    t1   Y1    t2   Y2
    I know it is convenient to use Write Measurement File express VI, but since this express VI open and close file in each loop execution, I prefer to use low-level File I/O functions to save computer resources (I need to reserve resources for image acquisition and analyses).
    The following attached VI just show the overall frame of the code, but is not executable now. I hope to get some suggestions from this forum to finish it.
    Here, I have two main questions, thank you in advance if you can provide hints to any of them.
    (1) How to get correct t0 and dt values for the waveform data
     I am using 25Hz pulse signal to externally trigger DAQmx  through PFI0.  I set 100Hz for the rate input of the DAQmx timing VI  since  LabVIEW help  says "If you use an external source for the Sample Clock, set this input to the
    maximum expected rate of that clock. " .
     When I use Write Measurement File express VI,  I found in the resulting text file, the dt is 0.01 instead of 0.04, i.e., the value of dt in the waveform data is not determined by external PFI0 signal, but by the rate input for the DAQmx timing VI.  Also, I found t0 does not always start from  zero.  However, from the display of data plot, I am sure the acquisition is at 25Hz.
    Some people in this forum ever told me to use Get Waveform Component and Build waveform functions to manually rebuild the waveform data in order to get correct t0 and dt. I tried and no luck to succeed.  Anyone can give me more detailed hints?
    (2) How to write data of 'NChan NSample' at one time in a loop
    I have two channel DAQmx, and for each channel there are several data points.  I plan to use following method to export data:
    Suppose in one loop DAQmx Read VI read 10 samples from each channel, so I assume I will get four arrays of 10 elements:
    t_channel_1, Y_channel_1, t_channel_2, Y_channel_2.
    Then I use a loop structure of N=10 to concatenate t1, tab,Y1,tab, t2,tab, Y2,return in 'element by element' mode, i.e., do 10 times of string concatenate and write to text file.
    I don't know whether above method is effective. Anyone can advise a better one?
    (3) Convert from timestamp to elapsed time in milisecond
    In the final text file, the time column should be the values of elapsed time in milisecond since the start of acquisition. So, I think I need to get the timestamp of the first data point so that for later data points I can use Elapsed Time express VI  to extract elapsed time in milisecond. However, I don't know how to get the timestamp at the starting of acquisition. Please advise if you know it.
    Sincerely,
    Dejun
    Message Edited by Dejun on 08-30-2007 10:34 AM
    Attachments:
    code.jpg ‏86 KB
    code.vi ‏49 KB

    tbob wrote:
    Ravens Fan:
    Read his post again:
    "I am using 25Hz pulse signal to externally trigger DAQmx  through PFI0.  I set 100Hz for the rate input of the DAQmx timing VI  since  LabVIEW help  says "If you use an external source for the Sample Clock, set this input to the maximum expected rate of that clock. " .
     When I use Write Measurement File express VI,  I found in the resulting text file, the dt is 0.01 instead of 0.04, i.e., the value of dt in the waveform data is not determined by external PFI0 signal, but by the rate input for the DAQmx timing VI.  Also, I found t0 does not always start from  zero.  However, from the display of data plot, I am sure the acquisition is at 25Hz."
    He says in the 1st paragraph that he sets theDAQmx timing to 100Hz because that is his maximum expected clock rate.  In the 2nd paragraph he says that in his measurement file dt is 0.01 instead of 0.04.  This indicates that the dt value is determined by the DAQmx timing rate, not the PFI0 clock rate.  I am thinking that he should set the DAQmx timing to match the PFI0 timing, 25Hz.
    Maybe this would work.
    You're right, I did misread what he said. But, I still have questions about what he said.  " I set 100Hz for the rate input of the DAQmx timing VI  ".  The code shows a rate input of 25 to the timing VI.  And nowhere else do I see a setting of 100Hz.  I ran his code (used a simulated device) and put an indicator on the to dt's in the clusters.  The came up as .04 which is what i would expect.  It is hard to comment what is going on in the file since there is nothing being send to the write text file VI.
    Message Edited by Ravens Fan on 08-31-2007 12:18 PM

  • Labview 7 index waveform array by channel name string

    I was messing around with the index array waveform function with a waveform array(3 elements). I had used the set waveform attribute vi with the name input set to "Channel Name." The index waveform array function would not return any data when I was passing a particular channel name to it. Inside the vi I noticed that the name input has to have the format "NI_ChannelName" to match the string constant. Is this explained in the documentation anywhere?? Wouldn't it be more useful to make this string constant a string control input that we wired data into?? Then we could index the waveform array based on any name input that we set with the waveform attribute function.

    Hi 08,
    despite reanimating an 11 year old thread that information you requested is given in the "Set Waveform Attribute Function" help as written by Brandon…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Best Way To Build An Array Of Many Elements

    Simple question for you LabVIEW experts: I want to build an array of many element for use in my code.  The problem is I have 20 elements I need to insert into the "Build Array Function."  This takes up much code space and is really not that clean.  I was thinking of using a For Loop and use the iteration terminal as the index for each element.  The For Loop would then use auto indexing and build this array for me.
    Is there a more efficient way to do this?  Thanks!

    hobby1 wrote:
    Crossrulz, I was planning on handling it like this: 
    I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?
    Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Indexing array of references element by element

    Hello,
    I have a simple question. How do I go about indexing an array of references element by element? For example, when using a cluster reference, there is a property node called "controls [ ]" that we can pass into a for loop. For a normal array, "enable indexing" is usually automatically turned on when entering a for loop. Why is it that for an array of references, this is not the case? Thanks for the help.
    Solved!
    Go to Solution.
    Attachments:
    array_of_references.JPG ‏35 KB

    Since the Get Image is a method, it has to work on something, and that would be a picture control or indicator.  (If you look at the Get Image Method for the array, you'll notice it only returns an image of the front panel object, so I think you'd just get a picture of the array as it looks on the FP).
    So you'd send the picture to an indicator, then use the Get image method on that indicator immediately afterwards.  See attached.  I didn't try this out so I can't be sure it would work, but I think it would.  But it would still be a major hack compared to just using the Picture to Pixmap VI.
    Message Edited by Ravens Fan on 03-27-2009 01:03 AM
    Attachments:
    Array_of_References[1]_BD.png ‏12 KB

  • "How would I add the rows of a 640 x 240 2D array together? I mean , the elements of row 1 to the element of row 2 and so on. I want to end up with a 1 d array of 640 elements in which each element is the sum of the other 240 elements in the rows."

    "For explaination , like this
    1 1 1 1 1 1 1 ....... to 640
    +2 2 2 2 2 2 2 .......
    +3 3 3 3 3 3 3 .......
    =6 6 6 6 6 6 6 ....... this is the final 1D array of summed elements."
    Appreciate the sample VI's but I can't open them ( I have Labview 5.01 )

    Here is Mikael solution, expanded to include rows and ready to use as a subVI. Now all is needed is the polymorphic version
    www.vartortech.com
    Attachments:
    Sum_rows_or_colums.vi ‏25 KB

  • Array of 50 elements

    hi! i just need a little help, i really dont need the whole program jus the important methods of it.
    Searching Array of 50 elements out of the 50 Integer Value in your Array,
    the user can enter a value & your program will display the specific
    subscript/index that contain the value
    All computation must be place in a method that returns a value.
    .

    has to be the sorriest excuse for a student I've seen in a while
    3 separate accounts at JavaWorld, all asking to be spoon-fed,
    http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=javabeginner&Number=26852&page=0&view=collapsed&sb=5&o=&fpart=1
    http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=javabeginner&Number=26884&page=0&view=collapsed&sb=5&o=&fpart=1
    http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=javabeginner&Number=26876&page=0&view=collapsed&sb=5&o=&fpart=1
    now at least this account at Sun
    @OP - your future is assured
    [email protected]

  • How to create array with "n" elements...

    Hy, how can i create a array with "n" elements ?

    i know, but the thing is: the other methode (which
    one isn't developed fom me) needs an Object Array
    (Object []) to work correctly...then take a look into the method toArray() of the Collection interface.
    thats why i need this gay "object Array"....I think it would be wise to avoid that adjective in this context and meaning.

  • Sort array with equal elements

    Hi, I'm a new one.
    I have a problem to sort 2d array with equal elements (it has 5000000 of elements from 1-255) for example:
    1 2 1 1 3 4 5 5 6 1 2 3 (value from 1-255)
    2 2 1 1 3 3 3 3 4 4 4 1 (value from 1-255)
    And I need make array or matrix 255 rows vs 255 colomns, and count how many equal elements for example:
      1  2 3 4 5 6
    1 0 1 0 1 0 0
    2 0 1 0 1 0 0
    3 1 0 1 0 0 0 
    4 0 0 1 0 0 0
    5 0 0 2 0 0 0
    6 0 0 0 1 0 0
    I'll be happy if someone could help me

    I understand that it's very complicated explain.
    I build 2d array from two 1darray each of them has values 1-255. So right now i must constract array or matrix 255x255 where must calculat how many times value from (1-255) for one array in another array and write this sum for each value 1-255. I try to show it
    1 2                         so I need array 3x3; for first row for value 1 I have two times value 3 and one time value 2
    2 2                                                                                    2 I have two times value 1 and one time value 2 and one time value 3
    3 2                                                                                    3 I have two times value 2 and one time value 3 
    3 2              so my result matrix will be      1   2  3
    3 3                                                       1  0  1  2
    2 3                                                       2  2  1  1
    2 1                                                       3  0  2  3
    2 1
    1 3
    1 3
    Maybe its more clear

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

  • Set chart value (property node) from a waveform ARRAY?!?

    Hi!
    In Labview 8.0 I want to send data to a front panel chart via its value property node. This works just fine if I wire a single waveform to the value property (attachment1). However, if I wire it with a waveform array (attachment2) it fails. Is there any workaround?
    Thanks in advance,
      Rudolf
    Attachments:
    attachment1.PNG ‏3 KB
    attachment2.PNG ‏3 KB

    The reason I was showing this with only one graph was that
    the
    two-graph version failed for me. I had tried having separate data
    sources, of course. Just to be sure I have rebuilt the VI from scratch
    as per your diagram (see attached image and VI) and run it again with
    the same results:
    The failure was not in my inability to see the
    plot but rather in an error message (attachment) which would only
    occur if I tried to wire more than a single plot into the value node.
    I subsequently also tried doing this using 1D and 2D DBL arrays and
    observed a similar problem: the 1D case works fine, the 2D case throws
    "insane object" errors and crashes labview entirely.
    Message Edited by frumpel on 04-05-2007 10:53 AM
    Attachments:
    test1.vi ‏16 KB
    block-diagram.PNG ‏33 KB
    error-message.PNG ‏15 KB

  • Waveform Array in Table

    How can I display content of a waveform array in a table? Within my solution I'm only able to show content in one cell. I'd like to have each vale in (only) one cell? See (simple) attachment.
    Thanks in advance
    Henrik
    Attachments:
    Wavf_Index_to_Table.vi ‏25 KB

    Andre is right on.  Here is an image.
    -cb
    Attachments:
    Waveform array to table.PNG ‏10 KB

  • Why did Fetch waveform Vi generates strange 1D array data(all elements are -5.2)?

    I just made some changes on the Getting Startted vi of tkds30xx scope driver to catch the start process of a power supply output(2Vdc). I use Initiate Acquisition vi followed by Fetch waveform vi to get the waveform on scope. I use a logical signal controlled by the Agilent 34903A switch to trigue the waveform acquisition. Then I get the 1D array output from Fetch waveform vi for calculation by another subvi. The waveform sample points are 10E+3 points(default). When running the program, the waveforms on the scope screen are right what I expect, but the 1D array data values are all -5.2V.

    Without seeing your code it would be hard to give specifics, but does -5.2V appear anywhere else in the system? One possibility is that you aren't looking at the channel you think you are.
    How much delay is there between when you tell the scope to begin acquisition and the read occurs? Could the read be getting its data before the scope actually triggers?
    What happens when you run the "Fetch Waveform" vi by itself? In other words, if you setup the system and generate the trigger manually such that the proper waveform is on the scope, does Fetch Waveform run by itself return the proper result?
    If this is not correcct there is something basically wrong with the function for reading the waveform. Again, giving specifics are hard, but open the VI and go
    through it statement by statement making sure that the settings and commands make sense for your application. Many vendors make excellent instrumentation, but I have yet to see one that could write a good driver.
    Also, could you describe what the proper waveform looks like?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Why does Read from Text file default to array of 9 elements

    I am writing to a text file starting with a type def. cluster (control) of say 15 dbl numeric elements, that works fine I open the tab-delimited text file and all of the elements appear in the file.  However when I read from the same text file back to the same type def. cluster (indicator), the read from text file defaults to 9 elements?? Is there a way to control how many elements are read from the file.  This all works great when I initially use a cluster of 9 elements and read back to a cluster of 9 elements.
    Solved!
    Go to Solution.

    From the LabVIEW Help: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/array_to_cluster/
    Converts a 1D array to a cluster of elements of the same type as the array elements. Right-click the function and select Cluster Size from the shortcut menu to set the number of elements in the cluster.
    The default is nine. The maximum cluster size for this function is 256.
    Aside: so, how many times has this question been asked over the years?

  • Store XML node value into an array with node element name

    Hi,
    I have the following code that displays the node element with the
    corresponding node value. I want to store the values in an array in
    reference to the node name.
    i.e.
    XML (my xml is much bigger than this, 300 elements):
    <stock>
    <symbol>SUNW</symbol>
    <price>17.1</price>
    </stock>-----
    would store the following:
    *data[symbol] = SUNW;*
    *data[price] = 17.1;*
    Thanks in advance,
    Tony
    test.jsp
    Here's my source code:
    <html>
    <head>
    <title>dom parser</title>
    <%@ page import="javax.xml.parsers.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="dombean.*" %>
    </head>
    <body bgcolor="#ffffcc">
    <center>
    <h3>Pathways Info</h3>
    <table border="2" width="50%">
    <jsp:useBean id="domparser" class="dombean.MyDomParserBean" />
    <%
    Document doc = domparser.getDocument("c:/stocks/stocks.xml");
    traverseTree(doc, out);
    %>
    <%! private void traverseTree(Node node,JspWriter out) throws Exception {
    if(node == null) {
    return;
    int type = node.getNodeType();
    switch (type) {
    // handle document nodes
    case Node.DOCUMENT_NODE: {
    out.println("<tr>");
    traverseTree
    (((Document)node).getDocumentElement(),
    out);
    break;
    // handle element nodes
    case Node.ELEMENT_NODE: {
    String elementName = node.getNodeName();
    //if(elementName.equals("MOTHER-OCC-YRS-PREVIOUS")) {
    //out.println("</tr>");
    out.println("<tr><td>"+elementName+"</td>");
    NodeList childNodes =
    node.getChildNodes();     
    if(childNodes != null) {
    int length = childNodes.getLength();
    for (int loopIndex = 0; loopIndex <
    length ; loopIndex++)
    traverseTree
    (childNodes.item(loopIndex),out);
    break;
    // handle text nodes
    case Node.TEXT_NODE: {
    String data = node.getNodeValue().trim();
    //if((data.indexOf("\n")  <0) &#38;&#38; (data.length() > 0)) {
    out.println("<td>"+data+"</td></tr>");
    %>
    </table>
    </body>
    </html>
    {code}
    *MyDomParserBean.java*
    Code: package dombean;
    {code:java}
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.io.*;
    public class MyDomParserBean
    implements java.io.Serializable {
    public MyDomParserBean() {
    public static Document
    getDocument(String file) throws Exception {
    // Step 1: create a DocumentBuilderFactory
    DocumentBuilderFactory dbf =
    DocumentBuilderFactory.newInstance();
    // Step 2: create a DocumentBuilder
    DocumentBuilder db = dbf.newDocumentBuilder();
    // Step 3: parse the input file to get a Document object
    Document doc = db.parse(new File(file));
    return doc;
    {code}
    Edited by: ynotlim333 on Sep 24, 2007 8:41 PM
    Edited by: ynotlim333 on Sep 24, 2007 8:44 PM
    Edited by: ynotlim333 on Sep 24, 2007 8:45 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I still need to store it in an array because its 300 elements in the XML stocks.
    I've done the following but its not working, i'm getting error codes. I think its an easy fix. I'd also like to pass a String instead of a .xml document b/c my xml is stored inside a DB. Any suggestions on that?
    <html>
    <head>
    <title>dom parser</title>
    <%@ page import="javax.xml.parsers.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="org.*" %>
    </head>
    <body bgcolor="#ffffcc">
    <center>
    <h3>Pathways Info</h3>
    <table border="2" width="50%">
    <jsp:useBean id="domparser" class="org.MyDomParserBean" />
    <%
    Document doc = domparser.getDocument("c:/stocks/stocks.xml");
    traverseTree(doc, out);
    %>
    <%!
            public String element_store = null;
            public String[] stock_data = new String[400];
            private void traverseTree(Node node,JspWriter out) throws Exception {
            if(node == null) {
               return;
            int type = node.getNodeType();
            switch (type) {
               // handle document nodes
               case Node.DOCUMENT_NODE: {
                 out.println("<tr>");
                 traverseTree
                 (((Document)node).getDocumentElement(),
                 out);
                 break;
              // handle element nodes
              case Node.ELEMENT_NODE: {
                String elementName = node.getNodeName();
                element_store = elementName;
                 //if(elementName.equals("MOTHER-OCC-YRS-PREVIOUS")) {
                   //out.println("</tr>");
                 NodeList childNodes =
                 node.getChildNodes();     
                 if(childNodes != null) {
                    int length = childNodes.getLength();
                    for (int loopIndex = 0; loopIndex <
                    length ; loopIndex++)
                       traverseTree
                       (childNodes.item(loopIndex),out);
                  break;
               // handle text nodes
               case Node.TEXT_NODE: {
                  String data = node.getNodeValue().trim();
                  if((data.indexOf("\n")  <0) && (data.length() > 0)) {
                  out.println("<tr><td>"+element_store+"</td>");
                  out.println("<td>"+data+"</td></tr>");
                  stock_data[element_store]=data;
    %>
    </table>
    </body>
    </html>

Maybe you are looking for