Thread Subject: importing multiple .dat files

Subject: importing multiple .dat files

From: Dominic

Date: 18 May, 2009 17:37:01

Message: 1 of 2

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 2

"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

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com