I wrote this on my Matlab code for my MacOs:
folder_list = 'folder_list.txt';
cd(folder_paraboles)
if exist(folder_list) == 0
commande = ['ls >',folder_list];
unix(commande)
end
Does anyone can give me the corresponding line code on Matlab Windows? Thanks a lot
Rather than using unix
to get the directory listing, you should just use the built-in dir
or ls
to get a list of files and then write them out to a file using MATLAB's built-in ability to write to files.
files = dir(pwd);
fid = fopen('output.txt', 'wt');
fprintf(fid ,'%s\n', files.name);
fclose(fid);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.