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: NNTP Server
Lines: 39
Message-ID: <k0mneb$gtg$>
References: <k0c1vj$2h3$> <k0m9qa$53f$> <k0mdn3$thd$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: 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={}, 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={}
     % process the file data here...

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.