function fullRO_mergeBeams(Geometry) % this function loops through a full RO folder and merges all the beamlets str = input('Enter num of beam batches: ','s'); % get the full RO folder beamlet_dir = uigetdir([Geometry.patient_dir ], 'Select full RO folder' ); if beamlet_dir == 0 disp('no file selected, aborting') return end % loop through all scenario folders files = dir(beamlet_dir); % Get a logical vector that tells which is a directory. dirFlags = [files.isdir]; % Extract only those that are directories. scenarioList = files(dirFlags); idxList = [1:numel(scenarioList)]; for i = 3:numel(idxList); scenario_i = idxList(i); scenario_path = [scenarioList(scenario_i).folder, '\', scenarioList(scenario_i).name]; merge_beamlets(str2double(str), scenario_path); disp(['Scenario ' num2str(i) ' merged!']) end disp('All scenario beamlets merged!') end