invalid concatenation of structure with matrix

Here's the full code:
folderTestCur = fullfile(folderTest,setTestCur);
ext = {'*.jpg','*.png','*.bmp'};
filepaths = [];
for i = 1 : length(ext):
filepaths = cat(1,filepaths,dir(fullfile(folderTestCur, ext{i})));
end

6 Comments

Either use sprintf or use filename = [path,ext{i}]
Tkanks for your answer. Where should I insert it please.
If I got you correctly, you are trying to create dynmaic pahfile inside the loop!! You can do the same inside the loop instead
Like that:
for ii = 1 : length(ext)
filepaths = [filepaths,dir(fullfile(folderTestCur, ext{ii}))];
end
Now I got another error:
error:
error:cat: dimension mismatch
No in the case, your approach is better. It works even with me without issues.

Sign in to comment.

 Accepted Answer

P = fullfile(folderTest,setTestCur);
X = {'*.jpg','*.png','*.bmp'};
N = numel(X);
C = cell(1,N);
for k = 1:N
C{k} = dir(fullfile(P,X{k}));
end
F = vertcat(C{:})

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!