Reputation: 361
I need to get the content of the selected folder as an array of strings in order to run a script for each file in a for loop. The way I am currently doing it I receive the content as a char two dimensional array.
Is there a way to get the contents directly as a string array instead of running each row in a loop and converting it to a String?
directory = uigetdir;
list = ls(strcat(directory, '\*.extension'))
for i = 1: ??
Upvotes: 0
Views: 280
Reputation: 60494
You want to use the dir
function:
list = dir(fullfile(directory, '*.extension'));
for ii=1:numel(list)
fullfile(list(ii).foler, list(ii).name)
end
Upvotes: 1