📌  相关文章
📜  在 matlab 中列出子目录 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:20.347000             🧑  作者: Mango

代码示例1
% Get a list of all files and folders in this folder.
files = dir('C:\Users\John\Documents\MATLAB\work')
% Get a logical vector that tells which is a directory.
dirFlags = [files.isdir]
% Extract only those that are directories.
subFolders = files(dirFlags)
% Print folder names to command window.
for k = 1 : length(subFolders)
  fprintf('Sub folder #%d = %s\n', k, subFolders(k).name);
end