Filter löschen
Filter löschen

Could we add variable in folder directory ??

1 Ansicht (letzte 30 Tage)
Ocean Blue
Ocean Blue am 13 Mär. 2012
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 ?!!

Akzeptierte Antwort

Jason Ross
Jason Ross am 13 Mär. 2012
  1 Kommentar
Jan
Jan am 13 Mär. 2012
Or explicitely:
for k = 1:4; xlsread(['D:\folder\', sprintf('%d', k). '\file']); end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by