Results 1 to 14 of 14
  1. #1
    samson is offline Member
    Join Date
    Mar 2007
    Posts
    16
    Rep Power
    0

    Default ECG plot in a textfile

    I like the ECG to be saved to a text file. I have an hardware to get the ECG , i will get the values I need to plot it using applet then to show it using and save it to a text file ?
    Can I get this ???

  2. #2
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    Look at this , Tell me if this is what you needed ?
    How can i display a line graph.. just like real time

  3. #3
    henna is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: ECG plot in a textfile

    i have a same query..
    i have ecg data stored in a text file, and i am plotting that data in jframe....
    ecg data is as follows:

    time volts
    0.003 -0.145
    0.006 -0.145
    0.008 -0.145
    ...my entire data is getting plot as a straight line......even if i take a ecg signal of 60 minutes the voltage values are in decimals and are very less and they vary with time also very less...
    i should be able to see the depths of d diagram.....there is where a noisy ECG signal lies...
    can anyone plz help me....thanks in advance..:-)

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: ECG plot in a textfile

    You need to show the code that is drawing the graph

  5. #5
    henna is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: ECG plot in a textfile

    Norm,..

    public void paintComponent(Graphics g)
    {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASIN G,
    RenderingHints.VALUE_ANTIALIAS_ON);
    g2.translate(0, getHeight() - 100);
    g2.scale(1, -1);
    g2.setPaint(Color.green.darker());

    int i=0;
    for(; i < a2.length-1;)
    {

    double x1 = a1[i];
    double y1 = a2[i];
    double x2 = a1[i+1];
    double y2 = a2[i+1];
    i=i+2;
    g2.draw(new Line2D.Double(x1, y1, x2, y2));
    }
    }

    //where a1[] and a2[]are the arrays where time and voltage values are stored....

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: ECG plot in a textfile

    What are the values of x1, x2, y1 and y2?
    How are they computed?

  7. #7
    henna is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: ECG plot in a textfile

    x-axis values are time values...and y-axis values are voltage values..as i showed previously...:
    time volts
    0.003 -0.145
    0.006 -0.145
    0.008 -0.145
    and they change very slowly...i mean voltage changes very slightly over a period of time.....


    i do not calculate as uch....directly plot the points..................

    but norm...i think u gave me an idea!!...should i calculate the values.. imean anything like 0.1=1+0.1....so that the graph becomes visible...??..

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: ECG plot in a textfile

    Add a println to print out the values of x1, x2, y1, y2 so you can see what the code is trying to draw.

  9. #9
    henna is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: ECG plot in a textfile

    i had added....i saw..its all right values ...exactly whatever the file has...!...
    i just removed it while showing it to u...
    my question is:
    it plots d graph...but as the values are very very less it gives a straight line on the output screen.....................
    and i want to see orignal graph..as in make the graph more visible......
    ie...as it would be in case of integer values..

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: ECG plot in a textfile

    You probably have to scale the data to make the graph you want to see.
    What is the range of the y values? What is the vertical size of the graph you want to plot?
    How many pixels per unit of data? For example what is the different in y value for .12 and .13?

  11. #11
    henna is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: ECG plot in a textfile

    the range of y values is from -0.100 to say -0.700.........whereas x values vary from 0.0 t0 60.0...
    iam new to java...
    i dint understand what u meant by "How many pixels per unit of data? For example what is the different in y value for .12 and .13?"

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: ECG plot in a textfile

    The size of the graph you are drawing is measured in pixels. My console is 1400 wide by 900 high.
    If I want to plot data that is in the range of .1 to .7 then I have to scale it to my screen.
    The max-min(delta) is .6. If I want to use 600 pixels vertically for the graph then I can show each .1 change in value by a 100 pixel change.
    A .1 value would plot at y=600, a .7 value at y=0

  13. #13
    henna is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: ECG plot in a textfile

    heyy!!...it got plotted...i directly scaled d values..
    something like this:
    x1=x1*100
    y1=y1*100....
    yeah!!...i can c d ecg wave!!

  14. #14
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: ECG plot in a textfile

    Quote Originally Posted by henna View Post
    i have a same query..
    In future, don't resurrect an old dead thread. Ask your question in a new thread -- they're free.

    .i can c d ecg wave!!
    This is a technical forum. Please use proper words.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Plot 2D graph in Java from RS-232 data
    By spratana in forum Java 2D
    Replies: 4
    Last Post: 02-11-2009, 06:49 PM
  2. Need Help for Dot Plot Graph
    By BHCluster in forum Java 2D
    Replies: 5
    Last Post: 04-15-2008, 02:54 PM
  3. Search TextFile
    By gsupriyarao@yahoo.com in forum Advanced Java
    Replies: 5
    Last Post: 04-11-2008, 11:03 AM
  4. textfile with Java problems
    By saytri in forum New To Java
    Replies: 4
    Last Post: 12-29-2007, 05:16 PM
  5. Textfile and GUI problems
    By saytri in forum New To Java
    Replies: 2
    Last Post: 12-21-2007, 04:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •