Path: news.mathworks.com!not-for-mail
From: "Daniel Robbins" <d.w.e.robbins@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Loading multiple files into a dataset
Date: Wed, 13 Jun 2012 16:37:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 18
Message-ID: <jrafjj$i8$1@newscl01ah.mathworks.com>
References: <jr7evo$a9k$1@newscl01ah.mathworks.com> <jr7k9u$5fb$1@newscl01ah.mathworks.com> <jr7lfr$au4$1@newscl01ah.mathworks.com> <jr7sae$cdg$1@newscl01ah.mathworks.com>
Reply-To: "Daniel Robbins" <d.w.e.robbins@gmail.com>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1339605427 584 172.30.248.35 (13 Jun 2012 16:37:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 13 Jun 2012 16:37:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2776992
Xref: news.mathworks.com comp.soft-sys.matlab:771006

Hi Steve,

I have tried both the methods on the link you provided, but I find that all of the data is not stored, only the first number in the text file is stored. If I use the importdata function then I can load the entire text file e.g.

textfiles=dir('*.txt');

for k = 1: length(textfiles)
            textfilename = [num2str (k), '.txt];
            a = importdata (textfilename);
end

However this over writes the data with each loop. I have googled around to look if there is anyway to create sequential variables e.g. a1,a2,a3...etc. However there are lots of pages indicating this is not the way to go.

The ultimate goal is to get all the text files loaded and combined in to one dataset, however I would like to be able to get MATLAB to read direct from the text files rather then load them each into excel organise them and then load using the dataset function. Obviously this would be very time consuming... 

Any help will be much appreciated.
Thanks
Dan