Error to this line.Functions cannot be indexed using {} or . indexing.

 Accepted Answer

The error message is clear already, isn't it? The core problem is:
fn = {dir(xyz).name};
If dir is a command, you cannot index its output by "." directly. Process it in different steps:
DirList = dir(fullfile(rootpath, subfolders{i}), '*.jpg'));
fn = { DirList.name };
By the way: char(subfolders(i)) wastes time with creating the scalar cell subfolders(i) at first. Using the cell indexing subfolder{i} replies to contained string directly.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 27 Oct 2017

Answered:

Jan
on 27 Oct 2017

Community Treasure Hunt

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

Start Hunting!