MATLAB: How to remove ‘Attempt to reference field of non-structure array’ this error

bag of feutureComputer Vision Toolboxpartition

I,m trying to do code of 'Bag Of Feature' on medical images.
My code like as below,
s = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\body\070.tif'));
s1 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\body\071.tif'));
s2 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\body\072.tif'));
s3 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\body\073.tif'));
s4 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\brain\P1.bmp'));
s5 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\brain\P2.bmp'));
s6 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\brain\P3.bmp'));
s7 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\brain\P4.bmp'));
s8 = imread(fullfile('C:\Users\Harshal\Desktop\images\harshal\brain\P5.bmp'));
CELL{1,1}= s;
CELL{1,2}= s1;
CELL{1,3}= s2;
CELL{1,4}= s3;
CELL{1,5}= s4;
CELL{1,6}= s5;
CELL{1,7}= s6;
CELL{1,8}= s7;
CELL{1,9}= s8;
imgeloc = CELL;
imgSet = imageloc;
[trainingSets,testSets] = partition(imgSet,0.3,'randomize');
At this step 'Attempt to reference field of non-structure array' this error occurs.
so what i do for this error.

Best Answer

imgSet = imageSet(imageloc);
You were passing the cell array in directly instead of passing in the imageSet