Movefile doesn't work

9 次查看(过去 30 天)
Dionysius Bryan
Dionysius Bryan 2018-11-25
Hi, I am trying to move files with specific filename into a new folder. Files that will be moved into new folder are selected based on interval values from other column.
The filename selection is worked but somehow the movefile doesn't read the filename. Here is my code:
fid = fopen ('Distiller.log','r')
skip = 29;
for ii = 1:skip-1
fgetl(fid);
end
line = fgetl(fid);
data = []
while (~isempty(line));
line =fgetl(fid);
line = regexprep(line, [^0-9\s+-.eE]','')
data = [data; str2num(line)];
end
sz=size(data);
num_sz=[1:(sz(1,1))]';
final_data=[data num_sz];
a=final_data(final_data(:,5)>372 & final_data(:,5)<=374,:)
a_str=num2str(A(:,6));
str_final_all=strcat(a_str,'.tif');
str_final_all_2=cellstr(str_final_all);
old = 'E:\Uji Coba\Image_seq\uji24april\Renamed';
new = 'E:\Uji Coba\Image_seq\uji24april\Selected';
mkdir(new)
for k=1:numel(str_final_all_2);
movefile(fullfile(old,str_final_all_2{k}), new);
end
The error is "No matching files were found" - "movefile(fullfile(old,str_final_all_2{k}), new)
I don't understand the error because the variabel for str_final_all_2 contains selected filenames
What is the solution?
Thank you very much
  2 个评论
TADA
TADA 2018-11-25
编辑:TADA 2018-11-25
Works for me
Maybe its a filesystem privilege issue?
I had similar issues with matlab not being able to move stuff on my desktop or my documents. My local user obviously has the privileges to do that, but Matlab might not.
Try copying the files to a subfolder of the root folder your matlab is working on, where it will clearly have the privilege to write to the file system, then run your script again. If it works, you will know that is the problem.
Walter Roberson
Walter Roberson 2018-11-25
At the moment we as onlookers have no reason to expect that 146.tif exists in that directory . perhaps you could show us the output of
ls(old)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by