Dear Guillaume, Thank you for caring to respond. This solution doesn't work, because in my datasetpaths.txt file there are multiple lines (i.e. multiple paths) while the cellstr(fileread('datasetpaths.txt')) command makes it read as a 1X1 matrix. I need to read each line separately and pass them to my program run.m. The 'datasetpaths.txt' is like as follows:
I:/datafolder/instrument_1/23Jan2015
I:/datafolder/instrument_5/23Jan2015
I:/datafolder/instrument_1/27Jan2015
I:/datafolder/instrument_2/29Jan2015
Here there are 4 lines, i.e. 4 paths. First my program should run the code as run('I:/datafolder/instrument_1/23Jan2015') Then run('I:/datafolder/instrument_5/23Jan2015') as so on.