필터 지우기
필터 지우기

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

답변 (1개)

Walter Roberson
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by