importdata: file name string operations

Hi,
My program simulates some physical stuff and I store my results in different files, which I index according to my liking. To gather more data I add another index to the file name, so that I can run the program on different computers and then collect all the data files without having to overwrite those that have the same (first) index. The whole thing eventually looks like this: ['file_name_primary_index' 'secondary_index']
This is the easy part. Now I have to access the files with the same primary index. I know the 1st part of the file name (which is 'file_name_primary_index'). The 2nd part doesn't interest me, because it could be anything, technically, so this one is unknown. But the importdata function requires the FULL name of the file.
The best way to do this is to shove the result of "dir file_name_primary_index" in a vector, so that I could get all names containing that string. Theoretically of course. Now I don't know how to do that. (A=dir is an option, but then, how do I pull off the unnecessary files?)
Thnx!

 Accepted Answer

a = dir('file_name_primary_index*'); %use wildcard

2 Comments

Guess I almost did that ... didn't put the * in the right place when guessing. :)
What's wildcard?
* is a wildcard that means anything. for example *.txt is all the text files in the directory

Sign in to comment.

More Answers (0)

Asked:

on 28 Aug 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!