What is Index exceeds matrix dimensions error in matlab? -


what error?

index exceeds matrix dimensions.
error in evalution (line 5)
bintempx(i,[1,2,3,4,5,6,7,8])=parentxy(i,[1,2,3,4,5,6,7,8]);

function [tempx_y_fxy] = evalution(parentxy,fxy)  i=1:6       bintempx(i,[1,2,3,4,5,6,7,8])=parentxy(i,[1,2,3,4,5,6,7,8]);       bintempy(i,[9,10,11,12,13,14,15,16],8)=parentxy(i,[9,10,11,12,13,14,15,16]);      dectempx=bin2dec(bintempx(i,[1,2,3,4,5,6,7,8]));     dectempy=bin2dec(bintempy(i,[9,10,11,12,13,14,15,16]));      tempx_y_fxy(i,1)=dectempx;     tempx_y_fxy(i,2)=dectempy;      tempx_y_fxy(i,3)=fxy(dectempx,dectempy);  end   tempx_y_fxy=sortrows(tempx_y_fxy,3);    end 

bintempx(i,[1,2,3,4,5,6,7,8])=parentxy(i,[1,2,3,4,5,6,7,8]);   %%% ------- 8 doing here??? bintempy(i,[9,10,11,12,13,14,15,16],**8**)=parentxy(i,[9,10,11,12,13,14,15,16]);  dectempx=bin2dec(bintempx(i,[1,2,3,4,5,6,7,8])); dectempy=bin2dec(bintempy(i,[9,10,11,12,13,14,15,16]));  tempx_y_fxy(i,1)=dectempx; tempx_y_fxy(i,2)=dectempy;  tempx_y_fxy(i,3)=fxy(dectempx,dectempy); 

change to:

bintempx(i,1:8)=parentxy(i,1:8);   % removed 8, because think typo?? bintempy(i,9:16)=parentxy(i,9:16);  dectempx=bin2dec(bintempx(i,1:8)); dectempy=bin2dec(bintempy(i,9:16));  tempx_y_fxy(i,1)=dectempx; tempx_y_fxy(i,2)=dectempy;  tempx_y_fxy(i,3)=fxy(dectempx,dectempy); 

if want select/assign multiple consecutive columns use 1:8 notation example. both should work in opinion second clearer , easier maintain.

and beaker said, check sizes of matrices, matrices use have @ least 6 rows , 16 columns?


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -