フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

after looping through folders

1 回表示 (過去 30 日間)
André Sousa
André Sousa 2014 年 5 月 27 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi there! So, this is what I have so far:
cd(fileparts(which(mfilename)));
start_path = cd topLevelFolder = uigetdir(start_path)
%topLevelFolder = 'C:\Users\RuiTiclo\Desktop\controlosprimeira';
allSubFolders = genpath(topLevelFolder)
disp('Patients');
remain = allSubFolders;
listOfFolderNames = {};
while true
[singleSubFolder, remain] = strtok(remain, ';');
if isempty(singleSubFolder)
break;
end
disp(sprintf('%s', singleSubFolder))
listOfFolderNames = [listOfFolderNames singleSubFolder];
end
%%%%%%%%%%%%%%
ans:
C:\Users\UserMe\Desktop\controls
C:\Users\UserMe\Desktop\controls\patient1
C:\Users\UserMe\Desktop\controls\patient2
C:\Users\UserMe\Desktop\controls\patient3
C:\Users\UserMe\Desktop\controls\patient4
C:\Users\UserMe\Desktop\controls\patient5
C:\Users\UserMe\Desktop\controls\patient6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The code above gives me acess to each of the folders inside my main folder. All the subfolders contain the same structure of sub organization, with multitple sub-sub folders and sub-sub-subfolders inside(they are results of MRI post processed scans). So, once I am inside a specific patient folder, how do I specify a path, for instance:
C:\Users\UserME\Desktop\controls\patientNumberX\results\DTI\run1 and then find a file caled( for instance): "dti_adc.nii" ??
IN SUMMARY, I already know how to loop through all the subfolders( patients). Now, for each subfolder, I want to specify a path and then find a file.
Help me solve this issue pls Regards
  3 件のコメント
Mahdi
Mahdi 2014 年 5 月 27 日
Can't you just use strcat and specify the whole path that you want to reach (from each of the files)
André Sousa
André Sousa 2014 年 5 月 27 日
I want to make it automatic, so that theuser only specifies the main folder ( the one with all patientes subfolder).

回答 (1 件)

Image Analyst
Image Analyst 2014 年 5 月 27 日
You're not getting the subfolder names. Try running my attached demo to see how I do it.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by