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!

 채택된 답변

bym
bym 2011년 8월 28일

0 개 추천

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

댓글 수: 2

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

질문:

2011년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by