Home set custom path for script in MATLAB
Reply: 1

set custom path for script in MATLAB

A.Ston
1#
A.Ston Published in 2017-12-07 19:09:23Z

I have a lot of folders each containing a lot of .txt files which i need to process with matlab.

i have a script finished which does it, it reads all .txt files in 1 folder and does some computing.

so if i want to process those files i move the script into the desired folder and run it, it is kinda lame to move the script every time.

is it possile to start a script in a standard directory, then make the script to ask me to browse for the desired directory to run the script in that directory? because it doesnt write any files, it just reads. after it finishes it should reset it, so i could browse to different folders every time. like save the path in a value and clear it at the end...

i use "fopen" in that script to open the .txt files, so it could be possible to assign the full path to that function, but its important to me to being able to browse the right folder every time i run the script.

A.Ston
2#
A.Ston Reply to 2017-12-08 07:29:05Z

i use

path=uigetdir;
fileid=fopen([path filesep 'file.txt']);

and it works just the way i wanted.

thanks @excaza and @Laure for a quick reply

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322175 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO