Clear Filters
Clear Filters

Could we add variable in folder directory ??

1 view (last 30 days)
I want to access several sequenced folders
Example :
[ndata, text, alldata] = xlsread('D:\folder\1\file');
[ndata, text, alldata] = xlsread('D:\folder\2\file');
[ndata, text, alldata] = xlsread('D:\folder\3\file');
[ndata, text, alldata] = xlsread('D:\folder\4\file');
Could I replace 1,2,3and 4 by variable i .. How could the directory be written here ?!!

Accepted Answer

Jason Ross
Jason Ross on 13 Mar 2012
  1 Comment
Jan
Jan on 13 Mar 2012
Or explicitely:
for k = 1:4; xlsread(['D:\folder\', sprintf('%d', k). '\file']); end

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!