Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2024-4-22
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!