how to know the current m-file directory in the mfile
how to know the current m-file directory in the mfile
(OP)
I want to open a file with the path like this [current m-file dir]\file\filename.txt. I found i cannot do like just textread('file\filename.txt'..) in the m-file. so i think i should know the m-file directory itselt first, then do the job. do anyone know how to do this? thank you!





RE: how to know the current m-file directory in the mfile
Cheers
Greg Locock
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: how to know the current m-file directory in the mfile
RE: how to know the current m-file directory in the mfile
s = mfilename;
s = which(s);
then delete the mfile name in the string s.....
RE: how to know the current m-file directory in the mfile
Use / instead of \
try something like
cd('c:/path')
textread('filename')
This what you needed?
BsK
RE: how to know the current m-file directory in the mfile
RE: how to know the current m-file directory in the mfile
TTFN