Is there a way of getting a file name and inserting into Matlab script?

Posted by torr on Stack Overflow See other posts from Stack Overflow or by torr
Published on 2011-11-23T17:46:49Z Indexed on 2011/11/23 17:50 UTC
Read the original article Hit count: 161

Filed under:
|
|

In a folder, I have both my .m file that contains the script and an imaging .dcm file that needs to be analyzed.

Folder structure:

Folder1/analysis.m
Folder1/meas_dynamic_123.dcm

My script (analysis.m) begins as follows:

target     =''; <== here should go the full path to the file + filename
                    example: /Volumes/Data/Folder1/meas_dynamic_123.m

txt        = dir(target);

// etc

So I'm wondering if there is a way of when running analysis.m it will:

  • automatically search the folder it's in,

  • grab the full path + filename of file containing string dynamic in the name,

  • insert its full path + name into target variable

  • continue running the script

Does anyone have any pointers on how to achieve this? Using ffpath?

© Stack Overflow or respective owner

Related posts about file

Related posts about matlab