Converting Dynamic ECG to Arrays

Hi, im new to this forum and LABView program.
I am doing an HRV analysis using LABView for a project in school, with the help of the NI developer's Zone HRV guide.
All are good while using a static .txt array for the input, but now i need to get a dynamic signal using a DAQ and an ECG simulator, and i am unable to write the DDT to arrays.
I have search the site for other people's query on this matter, but none of the method work on my program.
Anyone with around care for a help? I have i picture of my program uploaded:

The first thing to do is put your data acquisition and this code inside a while loop so that it run more than once. Then you can place a shift register on the while loop. Right click on the edge of the while loop and select Add Shift Register. Shown below is the basics.
Attachments:
Basic Shift Register.PNG ‏5 KB

Similar Messages

  • How can i convert object to byte array very*100 fast?

    i need to transfer a object by datagram packet in embeded system.
    i make a code fallowing sequence.
    1) convert object to byte array ( i append object attribute to byte[] sequencailly )
    2) send the byte array by datagram packet ( by JNI )
    but, it's not satisfied my requirement.
    it must be finished in 1ms.
    but, converting is spending 2ms.
    network speed is not bottleneck. ( transfer time is 0.3ms and packet size is 4096 bytes )
    Using ObjectOutputStream is very slow, so i'm using this way.
    is there antoher way? or how can i improve?
    Edited by: JongpilKim on May 17, 2009 10:48 PM
    Edited by: JongpilKim on May 17, 2009 10:51 PM
    Edited by: JongpilKim on May 17, 2009 10:53 PM

    thanks a lot for your reply.
    now, i use udp socket for communication, but, i must use hardware pci communication later.
    so, i wrap the communication logic to use jni.
    for convert a object to byte array,
    i used ObjectInputStream before, but it was so slow.
    so, i change the implementation to use byte array directly, like ByteBuffer.
    ex)
    public class ByteArrayHelper {
    private byte[] buf = new byte[1024];
    int idx = 0;
    public void putInt(int val){
    buf[idx++] = (byte)(val & 0xff);
    buf[idx++] = (byte)((val>>8) & 0xff);
    buf[idx++] = (byte)((val>>16) & 0xff);
    buf[idx++] = (byte)((val>>24) & 0xff);
    public void putDouble(double val){ .... }
    public void putFloat(float val){ ... }
    public byte[] toByteArray(){ return this.buf; }
    public class PacketData {
    priavte int a;
    private int b;
    public byte[] getByteArray(){
    ByteArrayHelper helper = new ByteArrayHelper();
    helper.putInt(a);
    helper.putInt(b);
    return helper.toByteArray();
    but, it's not enough.
    is there another way to send a object data?
    in java language, i can't access memory directly.
    in c language, if i use struct, i can send struct data to copy memory by socket and it's very fast.
    Edited by: JongpilKim on May 18, 2009 5:26 PM

  • How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers? (history data from a chart)

    Hello,
    in my vi I have a chart with 5 Plots displaying measurement data.
    The user should be able to save all the history data from the chart at anytime. (e.g. the user watches the chart and some event happens, then he presses a "save"-button)
    I know, that I can read out the history data with a property node. That is not the problem. The problem is, how do I handle the data? The type of the history data is a 1-D array of cluster of 5 elements.
    I have to convert that data somehow into a 2 D-array of numbers or strings, so that I can easily save it in a text-file.
    How do I convert a 1-D array of cluster of 5 elements into a 2-D array of numbers?
    I use LabVIEW 7.1
    Johannes
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Solved!
    Go to Solution.

    Gerd,
    thank you for the quick response and the easy solution.
    Look what I did in the meantime. I solved the problem too, but muuuch more complicate :-)
    And I have converted the numbers to strings, so that I can easily write them into a spreasheet file.
    Johannes
    Message Edited by johanneshoer on 04-28-2009 10:39 AM
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    SaveChartHistory.JPG ‏57 KB
    SaveChartHistory.JPG ‏57 KB

  • Converting object wrapper type array into equivalent primary type array

    Hi All!
    My question is how to convert object wrapper type array into equivalent prime type array, e.g. Integer[] -> int[] or Float[] -> float[] etc.
    Is sound like a trivial task however the problem is that I do not know the type I work with. To understand what I mean, please read the following code -
    //Method signature
    Object createArray( Class clazz, String value ) throws Exception;
    //and usage should be as follows:
    Object arr = createArray( Integer.class, "2%%3%%4" );
    //"arr" will be passed as a parameter of a method again via reflection
    public void compute( Object... args ) {
        a = (int[])args[0];
    //or
    Object arr = createArray( Double.class, "2%%3%%4" );
    public void compute( Object... args ) {
        b = (double[])args[0];
    //and the method implementation -
    Object createArray( Class clazz, String value ) throws Exception {
         String[] split = value.split( "%%" );
         //create array, e.g. Integer[] or Double[] etc.
         Object[] o = (Object[])Array.newInstance( clazz, split.length );
         //fill the array with parsed values, on parse error exception will be thrown
         for (int i = 0; i < split.length; i++) {
              Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
              o[i] = meth.invoke( null, new Object[]{ split[i] });
         //here convert Object[] to Object of type int[] or double[] etc...
         /* and return that object*/
         //NB!!! I want to avoid the following code:
         if( o instanceof Integer[] ) {
              int[] ar = new int[o.length];
              for (int i = 0; i < o.length; i++) {
                   ar[i] = (Integer)o;
              return ar;
         } else if( o instanceof Double[] ) {
         //...repeat "else if" for all primary types... :(
         return null;
    Unfortunately I was unable to find any useful method in Java API (I work with 1.5).
    Did I make myself clear? :)
    Thanks in advance,
    Pavel Grigorenko

    I think I've found the answer myself ;-)
    Never thought I could use something like int.class or double.class,
    so the next statement holds int[] q = (int[])Array.newInstance( int.class, 2 );
    and the easy solution is the following -
    Object primeArray = Array.newInstance( token.getPrimeClass(), split.length );
    for (int j = 0; j < split.length; j++) {
         Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
         Object val = meth.invoke( null, new Object[]{ split[j] });
         Array.set( primeArray, j, val );
    }where "token.getPrimeClass()" return appropriate Class, i.e. int.class, float.class etc.

  • Convert variable into an array

    I have variable, abc; whose value is in the format val1,val2,val3,..
    I want to convert it into an array, like that arr[0]=val1; arr[1]=val2; so on. How can I do this?
    Usman

    examine this class that I did
    import java.lang.*;
    public class ReadString {
    public static void main(String[] args){
    String abc = "1,2,3,4,5,6";
    StringBuffer abc2 = new StringBuffer(abc);
    int arrayLength = abc2.length(); //get length
    int[] abcFinal = new int[6];
    for (int i=0; i<arrayLength; i++) { //test characters
         int anIndex;
         if (!(abc2.substring(i,i+1)).equals(",")) { //if it is a number
         //(i/2) is ta little formula to be able to assign the
         //right index in the intArray to the number
         anIndex = (i/2);
         //set value to array
         abcFinal[anIndex] = Integer.parseInt(abc2.substring(i,i+1));
    for (int j=0;j<abcFinal.length;j++ ) {
         System.out.println("i = " + j + " value = " + abcFinal[j]);
    }//end main
    }//end class

  • Convert Dynamic Disk to Basic Disk Witout Data Loss

    I think I goofed somewhere and am in need of some advice.
    This Windows 8.1 home server had two identical 160GB drives that at one point were mirrored.  One of the drives failed but so I added a larger replacement hard drive (Disk 0 = 160GB, Disk 1 = 250GB) and was able to recover.  However now, not only
    is the mirror broken, but the configuration is crazy:
    Disk 0 contains 1 100MB System Reserved Parttion (System)
    Disk 1 contains 1 120GB partition where the OS is installed (Boot, Page File, Crash Dump)
    Since its much quicker to move 100MB vs 120GB, I was thinking I'd copy the 'System Reserved' partition on Disk 0 to Disk 1 using a third-party utility, but because both disks are Dynamic Disks, this isn't possible.
    So at this point I can only think of two options:
    Recreate the 'System Reserved' partition on Disk 1 (Is it as easy as running bootrec /scanos or /rebuildbcd or /fixmbr or /fixboot?) > Wipe Disk 0 > Confirm Windows 8.1 boots > Then create a new mirrored volume on Disk 0
    Mirror Partition 1 (120GB) on Disk 1 (where Windows is installed) to the available space (149GB) on Disk 0 > Break the mirror > Wipe Disk 0 > Confirm Windows 8.1 boots (maybe I'll need to run bootrec with some switch here?) > Then create a new
    mirrored volume on Disk 1
    Thoughts?

    See:
    How to Convert Dynamic Disk to Basic Disk without Data Loss?
    Carey Frisch
    Thanks for the reply.
    I've seen that post, among others, and they all require buying an application.  None of the product pages, like the one you linked indicate that a purchase is required.  It wasn't until I downloaded the aplications, (and I've tried several) that
    I discovered a purchase was required.  Really disappointed they weren't upfront about that on the guides.
    So maybe a different approach can be taken:
    Disk 1 just contains the System Recovery partition - the rest of the disk is blank (not partitioned)
    Create a new partition
    Copy the OS data from Disk 2 to Disk 1
    Update the System Recovery and/or the Boot Configuration Data file to point to the OS that's now on Disk 1
    Once updated, reboot
    The system should boot properly from Disk 1 and the OS should also be running from Disk 1
    Convert Disk 2 to a basic disk
    Once Disk 2 has been converted back to a basic disk, can I just do the opposite?
    Create 2 partitions on Disk 2: one for System recovery and another for OS
    Copy the System Recovery partition (partition on Disk 1) to partition 1 of Disk 2
    Copy the OS partition (partition 2 on Disk 1) to partition 2 of Disk 2
    Update the System Recovery and/or the Boot Configuration Data file to point to the OS that's now on Disk 2
    Once updated, reboot, the system should boot properly from Disk 2 and the OS should also be running from Disk 2
    Convert Disk 1 to a basic disk
    This is bonkers, believe me, but I feel silly shelling out $40-$50 for a single feature of an application.  If I were going to use it regularly, or even periodically, I would do it.
    I'm not very comfortable with bcdedit and bootrec so I need a little help with steps 4 in both sections.

  • Converting String to byte array

    Hi,
    There is a code for converting String to byte array, as follows:
         public byte[] toByteArray(String s)
              char[] c = s.toCharArray();
              int len = c.length;
              byte[] b = new byte[len * 2];
    for ( int i = 0 ; i < len ; i++ )
         b[i * 2] = (byte)(c);
         b[(i * 2) + 1] = (byte)(c[i] >> 8);
    return b;
    But this isn't doing the conversion properly. For example, for the � (euro) symbol, it converts to some other unreadable symbol. Also, same is the case for square brackets. Any idea why this' so? What's wrong with the above code?
    The encoding format is UTF-8.
    Thanks.

    > In fact, I tried with String.getBytes() too, but leads to the same problem, with those specific symbols.
    Did you try the String.getBytes(String charsetName) method?
    Both methods have been around since Java 1.1.
    It's an extremely important skill to learn to read the API and become familiar with the tools you will use to program Java. Java has an extensive set of online documentation that you can even download for your convenience. These "javadocs" are indexed and categorized so you can quickly look up any class or method. Take the time to consult this resource whenever you have a question - you'll find they typically contain very detailed descriptions and possibly some code examples.
    Java� API Specifications
    Java� 1.5 JDK Javadocs
    Best of luck!
    ~

  • How to convert from XML to Array ?

    how to convert from XML to Array ?
    thanks in advance

    this is a segment of the xml object:
    var myXML:XML =
    <data>
    <task>
    <taskID>2</taskID>
    <startDate>2/15/2007</startDate>
    </task>
    </data>
    i want to conver myXML into ArrayCollection: like this:
    private var expenses:Array = [
    {taskID:"1", startDate:"2/15/2007"},
    {taskID:"2", startDate:"4/15/2007"}
    how i can do it ? and tell me how to retrieve the data from
    the collection
    thanks

  • For dynamically allocated double arrays, sizeof() does not work

    For a typical double array, if you need to get the size, you would use
    numElems=(sizeof(myArray)/sizeof(myArray[0]));
    However, for dynamically allocated double arrays (see here for example) this no longer works.
    For the example above, sizeof(myArray) returns 4, and sizeof(myArray[0]) returns 8.
    Solved!
    Go to Solution.

    That's because sizeof(myArray) is the size of the pointer to the dynamically allocated array.
    sizeof(myArray[0]) is the size of a double (8 bytes).
    If you know the size you malloc'd then just use this instead of the sizeof(myArray) function.
    Array size (for use in bounds checking for example) is a compile-time thing in C89 (though CVI will hack in run-time bounds checking for you in a debug compile).  So even if you cast a malloc'd buffer pointer to an array type, the compiler's out of the picture at run time when the buffer gets established to a (potentially) run-time determined size, so it can't help you.  More modern languages (e.g. Java, C#) all get around this problem.  C99 allows variable length arrays to be declared but I'm not sure NI implemented this in their C99 upgrades.

  • Converting ASCII text (byte array ending in null) to a String

    Hi all,
    I am trying to convert a null terminated ascii string stored in a byte array to a java String. When I pass the byte array to the String constructor it
    does not detect/interpret the null as a terminator for the ascii string. Is this something I have to manually program in? ie Check for where the null is and then
    pass that subarray of everything before the null to the String constructor?
    example of problem
    //               A   B  C   D   null   F   (note F is junk in the array, and should be ignored since it is after null)
    byte[] asciiArray = { 65, 66, 67, 68, 0,  70 };
    System.out.println(new String(asciiArray, "UTF-8"));
    //this prints ABCD"sqare icon"F

    Why do you expect the null character to terminate the string? If you come from a C or C++ background, you need to understand that java.lang.String is not just a mere character array. It's a full-fledged Java object that knows its length without having any need for null terminator. So Ascii 0 is just another character for String object. To achieve what you want to do, you have to manually loop through the byte array and stop when you encounter a null character.

  • How to store the output of a analog to digital converter into an 2D array

    Hi
    I am doing my M.Tech Thesis in Image reconstruction and I am using labview for simulation and I want to know how to store the output of a analog to digital converter into an 2D labview array.

    nitinkajay wrote:
    I want to know how to store the output of a analog to digital converter into an 2D labview array.
    How exactly are you performing 'Analog to Digital'???
    Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Need help in converting string to numeric array

    I am trying to convert a string to a numeric array ... the first # in the string gets cut off, the last three seem to come through. 
    This may be fairly simple, but I really haven't worked with the string functions all that much.
    Help would be appreciated.
    Thanks,
    Attachments:
    String to Array Example.vi ‏10 KB

    Steve Chandler wrote:
    If you remove the first and last byte from the string using string subset then the read spreadsheet string would probably have worked.
    Yup.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    String to Array ExampleMOD2.vi ‏10 KB

  • Converting bytes to character array problem

    I am trying to convert a byte array into a character array, however no matter which Character Set i choose i am always getting the '?' character for some of the bytes which means that it was unable to convert the byte to a character.
    What i want is very simple. i.e. map the byte array to its Extended ASCII format which actually is no change in the bit represtation of the actual byte. But i cannot seem to do this in java.
    Does anyone have any idea how to get around this problem?

    Thanks for responding.
    I have however arrived at a solution. A little un-elegant but it seems to do the job.
    I am converting each byte into char manually by this algorithm:
              for (int i=0;i<compressedDataLength;i++)
                   if (((int) output)<0)
                        k=(127-((int) output[i]));
                        outputChr[i]=((char) k);
                   else
                        k=((int) output[i]);
                        outputChr[i]=((char) k);
                   System.out.println(k);
    where output is the byte array and outputChr is the character array

  • Convert digital waveform to array

    Hello,
    I posted a problem before Christmas regarding data acquisition and accessing the hardware buffer on a 6562 card. I managed to figure out that problem but now I'm stuck when I try manipulating the data I obtain. (The original problem can be seen here: http://forums.ni.com/ni/board/message?board.id=70&​thread.id=7926)
    Briefly, my application is clocking and synchronising an ADC board and then looking at the raw ADC data that comes back from the board. To provide synchronisation I am sending a sync pattern on one data line and using a second line to send a "start of frame" indicator, a '1' bit when I know that the board is synchronised. This line otherwise only sends ‘0’s. This cable is wired back into the NI card and LabView. All data sent uses the NI-SHDIO Generation Express VI and I'm using the Acquisition Express VI in parallel with the Generation VI to capture the raw ADC data when it comes off the ADC board. Since I am acquiring both the ADC data and the frame indication data (which I am looping by connecting that output DIO to an input DIO), the digital waveform essentially contains 2 arrays and I can view these from a graph indicator within LabView.
    No problems so far. In order to manipulate the data and look at individual frames I am writing the ADC data to file. To extract the digital data from the digital waveform I am using the following VIs:
    -Get Waveform Components
    -Get Digital Data Components
    -Write to Binary File
    To view and manipulate the data I read it into Matlab and this is where I can tell that something's not right. When I read the file into a variable in Matlab, the variable becomes a 1D double array of 40,008 elements. This seems very odd, considering the Acquisition VI only takes 20,000 samples. When I look at the 1D array more closely it looks like the two arrays have been cross added in some fashion. The 1D array certainly doesn't match either of the two arrays visible in the graph indicator inside LabView. I can understand if the file is reading one array after the other (20,000 + 20,000 almost equals 40,008 after all) but that doesn't appear to be the case.
    I would greatly appreciate some help on how I can extract the two data lines either using Matlab or LabView. Currently it looks like LabView is making a hash of things whenever I try to manipulate or extract the two arrays from the digital waveform. I have tried a multitude of different VIs and ideas but nothing appears to work.
    The most straight forward way would be using the "Converting Digital Waveform to Binary VI" but it can't handle two arrays within the same waveform. (The result looks like the two arrays exclusively OR’d together). To combat this I tried running two Acquisition Express VIs in parallel (one for ADC data, the other for the frame info) but got an error message referring to invalid handles. I presumed this meant that I can't run two acquisition VIs simultaneously, judging from forum posts of users facing the same error message.
    Sorry for the long post but I feel that I needed to fully explain the problem. I'm attaching my LabView code.
    Thank you for reading,
    Christian
    PS. GenAcq2.vi is my code. Waveform_GenAcq2_Cfg.hws is sent by the first Generation VI; Waveform_GenAcq2_shorter_frame_indicators.hws by the second Generation VI.
    Attachments:
    CodeAndWaveforms.zip ‏126 KB
    GenAcq_Screenshot.JPG ‏83 KB

    The extra "8" is being caused by the fact that the "Write to Binary File" VI has a "prepend array or string size" input. Its default is true, and in your case you have it unwired, so you get the array size prepended. As for the rest of your issue, what are your Matlab commands to read a file? The following example VI, which generates a digital waveform and saves it to file,
    can be correctly read into Matlab using the following commands:
    fid = fopen('c:\temp\digData.bin','r');
    F=fread(fid, [256,8], 'uchar');
    Message Edited by smercurio_fc on 01-18-2008 05:26 PM
    Attachments:
    Example_VI_BD.png ‏11 KB

  • Converting vector to string array

    How can I convert values in a vector into a string array?
    Vector formsVector = new Vector();
    while (rs.next())
    {formsVector.add(rs.getString("forms"));}
    String forms[] = (String[])formsVector.toArray();
    I tried the above line but it did not work. Any input please?
    Thanks

    .... What is the difference between the two as
    according to online help, both are same.
    String forms[] = (String [])formsVector.toArray();
    String forms[] = (String [])formsVector.toArray( new
    String[0] );The difference lies in the type of the object returned from toArray. The first form you list, formsVector.toArray(), always returns an Object[]. In your example, you'll get a ClassCastException at runtime when you cast to String[].
    The second form will try to use the array you pass in. If it's not big enough, it'll create a new one of the same type as that array. This is what's happening when passing a zero-length array into toArray.
    My personal preference is to save an extra instantiation and build the array to the proper size to begin with:String forms[] = (String [])formsVector.toArray( new String[formsVector.size()] );

Maybe you are looking for