Matlab: if condition when diemnsion of two matrices are not equal

formula, matlab

Solution

MATLAB provides a function to evaluate array equality: `isequal`.

So try:

if isequal(C,A)
   %do some computation
else if isequal(C,B)
   %do some other computation
else
   %print an error

Problem

I have two matrices that depends on the choice there would be some other computations. For example assume: ``` A = 8 9 3 9 6 5 2 1 9 ``` and ``` B = 11 9 11 8 2 2 2 8 9 8 11 5 1 9 1 11 11 10 5 4 6 9 11 8 1 ``` Now, I would choose one of them as new matirix ``` C = A; C = B; ``` If I use the following `if` condition I would have an error. ``` if C==A %do some computation else if C == B %do some other computation else %print an error ``` Because The dimension of matrices are not equal then I have an error. Would you please let me know how I could formulate this in right way?

Original source