Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
1 view (last 30 days)
Show older comments
I'm run this script. Could someone help me
rvar_selec=find(sum(Rsel_matrix)>=(ncut)); if (length(rvar_selec)==0) rvar_selec=find(sum(Rsel_matrix)>(0.25*nstab)); end
if (length(rvar_selec)==0) rvar_selec=rset; end
TrDat_rselec=TrDat(:,rvar_selec);
TeDat_rselec=TeDat(:,rvar_selec);
Model3 = fitcecoc(TrDat_rselec,TrLab_perm)
PredLab2(:,perm)=predict(Model2,TeDat_r) %* (Here, it indicates the error: Unable to perform assignment because the indices on the left side are not compatible with the size of the right side)
PredLab3(:,perm)=predict(Model3,TeDat_rselec
0 Comments
Answers (1)
Walter Roberson
on 22 Apr 2024
The output of predict(Model2,TeDat_r) will be a vector with the same number of rows as TeDat_r has. But TeDat_r is undefined here -- you probably want to predict(Model2,TeDat_rselec)
You would have a problem if perm is non-scalar.
You would have a problem on the second iteration of this code, if TeDat_rselec changes size then the number of rows output would change.
0 Comments
See Also
Categories
Find more on NaNs 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!