Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to plot ECG signal from .txt file?

Subject: how to plot ECG signal from .txt file?

From: Alexander

Date: 28 Jul, 2009 15:58:02

Message: 1 of 9

hi all, i need some help
i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process

here is some preview of the file: (around 800 row)
29554
30559
20590
29816
31610
30324
29813
30327
30583
30583
30068
30071
32124
30322
29297
31852
24912
28789
31100
31094
29813
30327
30840
30839
30325
30071
31358

please somebody help me, any answer is appreciated, many2 thanks before

Subject: how to plot ECG signal from .txt file?

From: us

Date: 28 Jul, 2009 16:03:01

Message: 2 of 9

"Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n76a$f5b$1@fred.mathworks.com>...
> hi all, i need some help
> i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
> actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process
>
> here is some preview of the file: (around 800 row)
> 29554
> 30559
> 20590
> 29816
> 31610
> 30324
> 29813
> 30327
> 30583
> 30583
> 30068
> 30071
> 32124
> 30322
> 29297
> 31852
> 24912
> 28789
> 31100
> 31094
> 29813
> 30327
> 30840
> 30839
> 30325
> 30071
> 31358
>
> please somebody help me, any answer is appreciated, many2 thanks before

a hint:

     help importdata;
     help textread;
     help textscan;
     help load; % <- also knows how to import ASCII files...

us

Subject: how to plot ECG signal from .txt file?

From: Alexander

Date: 28 Jul, 2009 16:15:19

Message: 3 of 9

"us " <us@neurol.unizh.ch> wrote in message <h4n7fk$42j$1@fred.mathworks.com>...
> "Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n76a$f5b$1@fred.mathworks.com>...
> > hi all, i need some help
> > i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
> > actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process
> >
> > here is some preview of the file: (around 800 row)
> > 29554
> > 30559
> > 20590
> > 29816
> > 31610
> > 30324
> > 29813
> > 30327
> > 30583
> > 30583
> > 30068
> > 30071
> > 32124
> > 30322
> > 29297
> > 31852
> > 24912
> > 28789
> > 31100
> > 31094
> > 29813
> > 30327
> > 30840
> > 30839
> > 30325
> > 30071
> > 31358
> >
> > please somebody help me, any answer is appreciated, many2 thanks before
>
> a hint:
>
> help importdata;
> help textread;
> help textscan;
> help load; % <- also knows how to import ASCII files...
>
> us

hmm,sorry, but actually i still don't get it even after i read those help
i mean in those help there's no instruction about plotting the file
btw,thx for ur reply n really appreciate better answer

Subject: how to plot ECG signal from .txt file?

From: Steve Amphlett

Date: 28 Jul, 2009 16:18:02

Message: 4 of 9

"Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n76a$f5b$1@fred.mathworks.com>...
> hi all, i need some help
> i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
> actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process
>
> here is some preview of the file: (around 800 row)
> 29554
> 30559
> 20590
> 29816
> 31610
> 30324
> 29813
> 30327
> 30583
> 30583
> 30068
> 30071
> 32124
> 30322
> 29297
> 31852
> 24912
> 28789
> 31100
> 31094
> 29813
> 30327
> 30840
> 30839
> 30325
> 30071
> 31358
>
> please somebody help me, any answer is appreciated, many2 thanks before


load filename.txt

will give you an array called filename.

name=load("filename.txt");

will give you a variable called name.

Subject: how to plot ECG signal from .txt file?

From: Alexander

Date: 28 Jul, 2009 16:22:02

Message: 5 of 9

"us " <us@neurol.unizh.ch> wrote in message <h4n7fk$42j$1@fred.mathworks.com>...
> "Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n76a$f5b$1@fred.mathworks.com>...
> > hi all, i need some help
> > i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
> > actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process
> >
> > here is some preview of the file: (around 800 row)
> > 29554
> > 30559
> > 20590
> > 29816
> > 31610
> > 30324
> > 29813
> > 30327
> > 30583
> > 30583
> > 30068
> > 30071
> > 32124
> > 30322
> > 29297
> > 31852
> > 24912
> > 28789
> > 31100
> > 31094
> > 29813
> > 30327
> > 30840
> > 30839
> > 30325
> > 30071
> > 31358
> >
> > please somebody help me, any answer is appreciated, many2 thanks before
>
> a hint:
>
> help importdata;
> help textread;
> help textscan;
> help load; % <- also knows how to import ASCII files...
>
> us

hmm,actually i still don't get it even after i read those help
i mean,those help don't tell me how to plot the file
wel sorry,but i'm quite newbie
anyway,really2 thx for ur answer n still appreciate better answer

Subject: how to plot ECG signal from .txt file?

From: us

Date: 28 Jul, 2009 16:27:01

Message: 6 of 9

"Alexander "
> > a hint:
> >
> > help importdata;
> > help textread;
> > help textscan;
> > help load; % <- also knows how to import ASCII files...
> >
> > us
>
> hmm,sorry, but actually i still don't get it even after i read those help
> i mean in those help there's no instruction about plotting the file
> btw,thx for ur reply n really appreciate better answer

well, well, a ...better... answer:

1) you must import your ASCII data into ML's workspace...
     -> hint...
2) see steve amphlett's code snippet how to do it...
3) once your data is in the workspace

     help plot;
     help line;

us

Subject: how to plot ECG signal from .txt file?

From: Alexander

Date: 28 Jul, 2009 16:27:01

Message: 7 of 9

"Steve Amphlett" <Firstname.Lastname@Where-I-Work.com> wrote in message <h4n8bq$m7$1@fred.mathworks.com>...
> "Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n76a$f5b$1@fred.mathworks.com>...
> > hi all, i need some help
> > i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
> > actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process
> >
> > here is some preview of the file: (around 800 row)
> > 29554
> > 30559
> > 20590
> > 29816
> > 31610
> > 30324
> > 29813
> > 30327
> > 30583
> > 30583
> > 30068
> > 30071
> > 32124
> > 30322
> > 29297
> > 31852
> > 24912
> > 28789
> > 31100
> > 31094
> > 29813
> > 30327
> > 30840
> > 30839
> > 30325
> > 30071
> > 31358
> >
> > please somebody help me, any answer is appreciated, many2 thanks before
>
>
> load filename.txt
>
> will give you an array called filename.
>
> name=load("filename.txt");
>
> will give you a variable called name.

i just try ur answer, but it give me an error message like this
??? name=load("a.txt");
              |
Error: The input character is not valid in MATLAB statements or expressions.

n if i get the variable,what should i do with it to plot my ECG signal?

Subject: how to plot ECG signal from .txt file?

From: Wayne King

Date: 28 Jul, 2009 16:35:19

Message: 8 of 9

Hi Alexander, strings in Matlab are denoted by single quotes and not double, e.g. 'this.txt' and not "this.txt". Once you have the data look at the help for plot.

>>doc plot

Your data will be a vector in the Matlab workspace and it will be very easy to plot.

Hope that helps,
wayne



"Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n8sl$57d$1@fred.mathworks.com>...
> "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com> wrote in message <h4n8bq$m7$1@fred.mathworks.com>...
> > "Alexander " <shadeslayer_777@yahoo.com> wrote in message <h4n76a$f5b$1@fred.mathworks.com>...
> > > hi all, i need some help
> > > i got .txt file consist of ECG signal and i want to plot it in MATLAB, but i don't know how to do it
> > > actually the original file is .hexa and my friend convert it to .txt so it is easier for me to process
> > >
> > > here is some preview of the file: (around 800 row)
> > > 29554
> > > 30559
> > > 20590
> > > 29816
> > > 31610
> > > 30324
> > > 29813
> > > 30327
> > > 30583
> > > 30583
> > > 30068
> > > 30071
> > > 32124
> > > 30322
> > > 29297
> > > 31852
> > > 24912
> > > 28789
> > > 31100
> > > 31094
> > > 29813
> > > 30327
> > > 30840
> > > 30839
> > > 30325
> > > 30071
> > > 31358
> > >
> > > please somebody help me, any answer is appreciated, many2 thanks before
> >
> >
> > load filename.txt
> >
> > will give you an array called filename.
> >
> > name=load("filename.txt");
> >
> > will give you a variable called name.
>
> i just try ur answer, but it give me an error message like this
> ??? name=load("a.txt");
> |
> Error: The input character is not valid in MATLAB statements or expressions.
>
> n if i get the variable,what should i do with it to plot my ECG signal?

Subject: how to plot ECG signal from .txt file?

From: Alexander

Date: 28 Jul, 2009 16:37:02

Message: 9 of 9

"us " <us@neurol.unizh.ch> wrote in message <h4n8sl$57b$1@fred.mathworks.com>...
> "Alexander "
> > > a hint:
> > >
> > > help importdata;
> > > help textread;
> > > help textscan;
> > > help load; % <- also knows how to import ASCII files...
> > >
> > > us
> >
> > hmm,sorry, but actually i still don't get it even after i read those help
> > i mean in those help there's no instruction about plotting the file
> > btw,thx for ur reply n really appreciate better answer
>
> well, well, a ...better... answer:
>
> 1) you must import your ASCII data into ML's workspace...
> -> hint...
> 2) see steve amphlett's code snippet how to do it...
> 3) once your data is in the workspace
>
> help plot;
> help line;
>
> us

well, i already load the file n plot it, but it turn out strange
i mean in normal ECG sample like some i got from MIT-BIH the amplitude is not this high n the time seems wrong

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us