求问关于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无法读取到数据 到底时什么原因呢

 Accepted Answer

harmvws
harmvws on 22 May 2023

0 votes

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

More Answers (0)

Categories

Tags

Asked:

on 22 May 2023

Answered:

on 22 May 2023

Community Treasure Hunt

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

Start Hunting!