Error using movefile: Arguments must contain a character vector.
이전 댓글 표시
I have a whole bunch of images that I need to sort and save based on their study, name and date, which is there in the name of the images itself, eg "ABC_20180712_121343_L_001.png", where the 2nd portion is the date, 3rd being the time stamp, 4th being the criteria of the study and 5th is the image number. So, I create a new folder reading the name, criteria and date, eg "L_20180712_121343", but time only in cases where there are two images of the same date. After that I try to move the image to that folder, but matlab shows the error "Error using movefile: Arguments must contain a character vector." Here is part of whole code:
for k=3:length(dir_L)
name_img = dir_L(k,1).name; %read the names
name_1 = strsplit(name_img,{'_','.'});
name = name_1{1};
date = name_1{2};
time = name_1{3};
study = name_1{4};
if k==3
newfolder=strcat(study,'_',date); %naming the new folder
mkdir(newfolder); %creating the folder
end
img = imread(name_img);
movefile (img, newfolder); %transfering the images to the folder
end
I don't know what am I doing wrong.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!