The end operator must be used within an array index expression
显示 更早的评论
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 个评论
Stephen23
2022-1-21
@Sharena Natasha Nor Hisham: please show us the complete error message. This means all of the red text.
Sharena Natasha Nor Hisham
2022-1-21
编辑:Sharena Natasha Nor Hisham
2022-1-21
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
2022-1-22
编辑:Sharena Natasha Nor Hisham
2022-1-22
Sharena Natasha Nor Hisham
2022-1-22
Cris LaPierre
2022-1-22
Please create a new question for this as it is unrelated.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!