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:
importing multiple .dat files

Subject: importing multiple .dat files

From: Dominic

Date: 18 May, 2009 17:37:01

Message: 1 of 6

I am trying to write a for loop which will allow me to import multiple .dat files of different sizes all from the same folder.

Thus far I have written the code to import a single file, but when I try making the necessary changes to loop it I get all sorts of errors.

Here is my code so far:
%load the dat file
[FileName, FilePath, FILTERINDEX] =uigetfile('C:\Dominic\PT40491\data\*.dat','Select a Holter file to read');
FileNamePath=strcat(FilePath,'\',FileName);
%load the ECG data
[sample V5 AP]=textread(FileNamePath,'%f%f%f');
ECG=AP;
clear V5 AP

Subject: importing multiple .dat files

From: Pekka Kumpulainen

Date: 19 May, 2009 05:55:02

Message: 2 of 6

"Dominic " <dcg48@cornell.edu> wrote in message <gus6bt$reh$1@fred.mathworks.com>...
> I am trying to write a for loop which will allow me to import multiple .dat files of different sizes all from the same folder.
>
> Thus far I have written the code to import a single file, but when I try making the necessary changes to loop it I get all sorts of errors.
>
> Here is my code so far:
> %load the dat file
> [FileName, FilePath, FILTERINDEX] =uigetfile('C:\Dominic\PT40491\data\*.dat','Select a Holter file to read');
> FileNamePath=strcat(FilePath,'\',FileName);
> %load the ECG data
> [sample V5 AP]=textread(FileNamePath,'%f%f%f');
> ECG=AP;
> clear V5 AP

Those all sorts of errors usually contain informative text on what goes wrong.
Have you read 4.12 in FAQ:
http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: importing multiple .dat files

From: mrichman@intehealth.com

Date: 26 Mar, 2013 00:58:20

Message: 3 of 6

On Monday, May 18, 2009 1:37:01 PM UTC-4, Dominic wrote:
> I am trying to write a for loop which will allow me to import multiple .dat files of different sizes all from the same folder.
>
> Thus far I have written the code to import a single file, but when I try making the necessary changes to loop it I get all sorts of errors.
>
> Here is my code so far:
> %load the dat file
> [FileName, FilePath, FILTERINDEX] =uigetfile('C:\Dominic\PT40491\data\*.dat','Select a Holter file to read');
> FileNamePath=strcat(FilePath,'\',FileName);
> %load the ECG data
> [sample V5 AP]=textread(FileNamePath,'%f%f%f');
> ECG=AP;
> clear V5 AP

--------------------------

Dominic,
  I was just handed a Holter .dat file from a potential customer to see if we could process the file. Do you know if there are any SDK's that could be used to read or convert the data for .NET?

Thanks!

Mike Richman (mrichman@intehealth.com)

Subject: importing multiple .dat files

From: dpb

Date: 26 Mar, 2013 01:42:22

Message: 4 of 6

On 3/25/2013 7:58 PM, mrichman@intehealth.com wrote:
> On Monday, May 18, 2009 1:37:01 PM UTC-4, Dominic wrote:
>> I am trying to write a for loop which will allow me to import
>> multiple .dat files of different sizes all from the same folder.
>>
>> Thus far I have written the code to import a single file, but when
>> I try making the necessary changes to loop it I get all sorts of errors.
>>
>> Here is my code so far:
>> %load the dat file
>> [FileName, FilePath, FILTERINDEX] =...
            uigetfile('C:\Dominic\PT40491\data\*.dat', ...
            'Select a Holter file to read') ...
            'MultiSelect', 'on');
    % check didn't CANCEL...
    if isequal(filename,0)
        error('No file(s) selected')
    end

    for f=FileName
      % fixup stupid difference in uigetfile return...
      if iscell(f), f=char(f); end
      % build the full name from pieces parts...
      fName=fullfile(FilePath,f);

>> %load the ECG data
>> [sample V5 AP]=textread(fName,'%f%f%f');
...
      % do whatever w/ data for this file here...
      ...
      % next file
    end

No idea on what a Holter file is, sorry; just saw the query about
multiple files w/ no answer.

--

Subject: importing multiple .dat files

From: Barry Williams

Date: 26 Mar, 2013 10:14:06

Message: 5 of 6

dpb <none@non.net> wrote in message <kique2$ouk$1@speranza.aioe.org>...
> On 3/25/2013 7:58 PM, mrichman@intehealth.com wrote:
> > On Monday, May 18, 2009 1:37:01 PM UTC-4, Dominic wrote:
> >> I am trying to write a for loop which will allow me to import
> >> multiple .dat files of different sizes all from the same folder.
> >>
> >> Thus far I have written the code to import a single file, but when
> >> I try making the necessary changes to loop it I get all sorts of errors.
> >>
> >> Here is my code so far:
> >> %load the dat file
> >> [FileName, FilePath, FILTERINDEX] =...
> uigetfile('C:\Dominic\PT40491\data\*.dat', ...
> 'Select a Holter file to read') ...
> 'MultiSelect', 'on');
> % check didn't CANCEL...
> if isequal(filename,0)
> error('No file(s) selected')
> end
>
> for f=FileName
> % fixup stupid difference in uigetfile return...
> if iscell(f), f=char(f); end
> % build the full name from pieces parts...
> fName=fullfile(FilePath,f);
>
> >> %load the ECG data
> >> [sample V5 AP]=textread(fName,'%f%f%f');
> ...
> % do whatever w/ data for this file here...
> ...
> % next file
> end
>
> No idea on what a Holter file is, sorry; just saw the query about
> multiple files w/ no answer.
>
> --

Holter is an external cardiac function monitor. There can be several different data files associated with the device, and AFAIK they can vary depending upon the number/types of signals recorded. You might try http://biosig.sourceforge.net/index.html
There is some open source code available that may be of help to you.
Barry

Subject: importing multiple .dat files

From: Barry Williams

Date: 26 Mar, 2013 14:23:10

Message: 6 of 6

mrichman@intehealth.com wrote in message <1d23a395-4010-405b-b3e5-ca1115ab1a99@googlegroups.com>...
> On Monday, May 18, 2009 1:37:01 PM UTC-4, Dominic wrote:
> > I am trying to write a for loop which will allow me to import multiple .dat files of different sizes all from the same folder.
> >
> > Thus far I have written the code to import a single file, but when I try making the necessary changes to loop it I get all sorts of errors.
> >
> > Here is my code so far:
> > %load the dat file
> > [FileName, FilePath, FILTERINDEX] =uigetfile('C:\Dominic\PT40491\data\*.dat','Select a Holter file to read');
> > FileNamePath=strcat(FilePath,'\',FileName);
> > %load the ECG data
> > [sample V5 AP]=textread(FileNamePath,'%f%f%f');
> > ECG=AP;
> > clear V5 AP
>
> --------------------------
>
> Dominic,
> I was just handed a Holter .dat file from a potential customer to see if we could process the file. Do you know if there are any SDK's that could be used to read or convert the data for .NET?
>
> Thanks!
>
> Mike Richman (mrichman@intehealth.com)

BTW, note that Dominic hasn't posted at this newsgroup since 2009. The odds that he looks at the posts on anything like a regular basis are probably pretty slim. Rather than replying to a fairly generic post with a subject 'Importing multiple .dat files', which could be ignored if we see that there have already been multiple responses, you might have a better chance of getting someone who is familiar with your problem to respond if you added a new thread with a more specific subject, like 'Importing Holter monitor data files'.
Barry

Tags for this Thread

No tags are associated with 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