필터 지우기
필터 지우기

How do I solve backslash issue in this case?

조회 수: 12 (최근 30일)
Shu Yi Ho
Shu Yi Ho 2019년 8월 14일
편집: KSSV 2019년 8월 14일
selpath = uigetdir;
imageFolder = dir(fullfile(selpath,'\\*.jpg'));
%imageFolder = dir('C:\Users\85042513\MATLAB\Projects\BAT CVE\Images\NG\*.jpg');
numfiles = length(imageFolder);
ori_roi = cell(numfiles, 1);
i = 1;
filename = strcat(selpath,imageFolder(i).name);
originalImage = imread(filename); %(line 42)
%% LOOP THROUGH ALL IMAGES IN THE FOLDER & RUN ALL THE 5 FUNCTIONS
for i=1:length(imageFolder)
tic
functionError = 0;
filename = strcat(selpath,imageFolder(i).name);
originalImage = imread(filename);
ori_roi{i} = originalImage( rect(2) : (rect(2)+rect(4)) , rect(1) : (rect(1)+rect(3)) , : );
...
I have tried:
imageFolder = dir(fullfile(selpath,'\*.jpg'));
It has the same issue.

채택된 답변

KSSV
KSSV 2019년 8월 14일
편집: KSSV 2019년 8월 14일
Replace this line:
filename = strcat(selpath,imageFolder(i).name);
with:
filename = fullfile(selpath,imageFolder(i).name);
If you are admant using strcat use:
filename = strcat(selpath,filesep,imageFolder(i).name);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by