Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!feeder.erje.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Combine variable length vectors into one vector
Date: Fri, 17 Aug 2012 19:25:43 -0500
Organization: Aioe.org NNTP Server
Lines: 39
Message-ID: <k0mneb$gtg$1@speranza.aioe.org>
References: <k0c1vj$2h3$1@newscl01ah.mathworks.com> <k0m9qa$53f$1@newscl01ah.mathworks.com> <k0mdn3$thd$1@speranza.aioe.org>
NNTP-Posting-Host: rAkrzyc82prppDd3vNtTIQ.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:776713

On 8/17/2012 4:39 PM, dpb wrote:
...

>> I've decided to just use the files directly from the results of dir() as
>> you both said. It is much easier and I don't have to build up a cell
>> array.
>
> That is indeed, a far better direction...
>
> You might try
>
> d=dir('yourmask*.dat');
> for f={d.name}, disp(f),end
>
> just for fun... :)
>
> doc for % for the mystery unraveled (assuming it is one, anyway...)

And, another way to do the loop thru the files looking at your list in 
what appears to be a single pass...

Assuming c is the cell of file patterns to match of the earlier posting..

for i=1:length(c)
   d=dir(sprintf('*s*L*.txt', char(c(i));
   for fn={d.name}
     x=textread(fn);
     % process the file data here...
   end
end

This does use two loops but nests them.  In the end it processes the 
files in the same order as the two separate steps of getting all the 
files into another list and the processing the list.

What is "most bestest" for your needs depends on what you've not told 
us--what you're actually doing w/ the file data.

--