求问关于dir函数读取bmp图片名称的问题。

dirs = dir('E:\matlab\bin\b895d485\test1_images'); % 设定根目录,并读取根目录下的文件夹
l = length(dirs)-2;
for i=3:l+2
path=strcat('samples/ ',dirs(i).name, '/');% 生成当前目录下的路径
files = dir(strcat(path,'*.bmp')); % 获取第i个路径下所有文件名称
end
files无法读取到数据 到底时什么原因呢

 Réponse acceptée

harmvws
harmvws le 22 Mai 2023

0 votes

线看files文件名 是否确正确拼接出来, 如果正确没法打开文件,就看matlab 是否有相关文件的读取权限,修改文件的读取权限, 或者 以管理员身份运行matlab 再试试

Plus de réponses (0)

Catégories

En savoir plus sur 文件操作 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!