"Roger Stafford" wrote in message <kd041f$b2v$1@newscl01ah.mathworks.com>...
> "sam " <s_abcdf@yahoo.com> wrote in message <kd01u0$47g$1@newscl01ah.mathworks.com>...
> > I write a simple program to compare between two binary arrays, when the arrays is the same values the program work in good way, but when there is some errors in any arrays the program does not work correctly.
>
> It is true that both the 'if' and 'elseif' statements require all elements of a nonscalar logical expression to be true. This does accomplish what you want at the first step, but not in the following steps. You don't want to exhibit 'There is Error in X1 and X2' only when each element of X1 differs from the corresponding element of Y1 and each element of X2 differs from each one of Y2. You want it exhibited when there are any differences even as few as one in either X1 or X2. For this purpose you should be writing something like this.
>
> t1 = all(X1==Y2);
> t2 = all(X2==Y2);
===============
Or,
t1=isequal(X1,Y1);
t2=isequal(X2,Y2);
etc...
