Mar 29, 2011 #1 J jess17 Junior Member level 3 Joined Mar 4, 2011 Messages 26 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,431 I have a matrix X = [a, b ,c ; d ,e ,f; h, i ,j] and the values a,b,c,d,e,f,g,h,i,j are not pre known. but i need to find out if they hold the same value, ie if a=b=c=d=e=f=h=g etc.
I have a matrix X = [a, b ,c ; d ,e ,f; h, i ,j] and the values a,b,c,d,e,f,g,h,i,j are not pre known. but i need to find out if they hold the same value, ie if a=b=c=d=e=f=h=g etc.
Mar 30, 2011 #2 H horace1 Advanced Member level 5 Joined Nov 18, 2008 Messages 2,118 Helped 596 Reputation 1,188 Reaction score 571 Trophy points 1,393 Location Norwich, UK Activity points 13,063 could you use a simple loop? e.g. Code: bool same=true; for(i=0;i<3;i++) for(j=0;j<3;j++) if(X[0][0] != X[i][j]) same= false; could be made more efficent as a function, return when the comparison fails
could you use a simple loop? e.g. Code: bool same=true; for(i=0;i<3;i++) for(j=0;j<3;j++) if(X[0][0] != X[i][j]) same= false; could be made more efficent as a function, return when the comparison fails