The end operator must be used within an array index expression
Show older comments
My output is showing "The end operator must be used within an array index expression." when I try to run this:
%15. split spectograms of background noise between the training, validation, and test sets
numTrainBkg = floor(0.85*numBkgClips);
numValidationBkg = floor(0.15*numBkgClips);
XTrain(:,:,:,end+1:end+numTrainBkg) = Xbkg(:,:,:,1:numTrainBkg);
YTrain(end+1:end+numTrainBkg) = "background";
XValidation(:,:,:,end+1:end+numValidationBkg) = Xbkg(:,:,:,numTrainBkg+1:end);
YValidation(end+1:end+numValidationBkg) = "background";
Please help me solve this..
6 Comments
Stephen23
on 21 Jan 2022
@Sharena Natasha Nor Hisham: please show us the complete error message. This means all of the red text.
Sharena Natasha Nor Hisham
on 21 Jan 2022
Edited: Sharena Natasha Nor Hisham
on 21 Jan 2022
Please run the following command from within the scope where these variables are defined (i.e., I don't know if this is in a function or a script; if it's a function put this line in the function after where the variables are defined and before where the error happens; if it's a script you can just run this line on the MATLAB command prompt):
whos XTrain YTrain XValidation YValidation Xbkg
and show the output. This will tell us what type of variables these are. It seems like at least one of them is not an array.
Sharena Natasha Nor Hisham
on 22 Jan 2022
Edited: Sharena Natasha Nor Hisham
on 22 Jan 2022
Sharena Natasha Nor Hisham
on 22 Jan 2022
Cris LaPierre
on 22 Jan 2022
Please create a new question for this as it is unrelated.
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!