Array formation and parentheses-style indexing with objects of class 'matlab.io.datastore.CombinedDatastore' is not allowed. Use objects of class 'matlab.io.datastore.CombinedDatastore' only as scalars or use a cell array. #107
Closed
Devika21-hub
started this conversation in
Q&A
Replies: 1 comment
-
Hi, are you working on any of the challenge projects? I think MATLAB Answer is the best place to post this sort of questions. Beside, there is already an answer to this question here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
clc
close all
%%%%% Change path to your system path %%%%%%%%%%%%%%%%%%%%%%%%55
rootFolder = fullfile('/MATLAB Drive/caltech-101');
imageDatastore = [ imageDatastore(fullfile(rootFolder, 'lotus')), ...
imageDatastore(fullfile(rootFolder, 'panda')), ...
imageDatastore(fullfile(rootFolder, 'laptop') ) ];
{ imageDatastore.Description } % display all labels on one line
[imageDatastore.Count] % show the corresponding count of images
minimageDatastoreCount = min([imageDatastore.Count]); % determine the smallest amount of images in a category
% Use partition method to trim the set.
imageDatastore = partition(imageDatastore, minimageDatastoreCount, 'randomize');
% Notice that each set now has exactly the same number of images.
[imageDatastore.Count]
[trainingimageDatastore, validationimageDatastore] = partition(imageDatastore, 0.3, 'randomize');
lotus = read(trainingimageDatastore(1),1);
panda = read(trainingimageDatastore(2),1);
laptop = read(trainingimageDatastore(3),1);
figure
subplot(1,3,1);
imshow(lotus)
subplot(1,3,2);
imshow(panda)
subplot(1,3,3);
imshow(laptop)
What changes need to be done to the code mentioned to overcome the error mentioned in title??
Beta Was this translation helpful? Give feedback.
All reactions