Compare two matrices with Boolean statement in Matlab -


simple questions

v = [1,2,3,4] w = [1,2,4,4]

v == w

returns

1 1 0 1

it compares entry entry, why not whole array , return 0? how accomplish that?

also if see datatype it's 1x4 logical, mean; 1x4 matrix logical datatypes?

i didn't knew matrix contain logical datatypes. how convert 1x4 logical matrix matrix numeric datatypes?

so these questions.

why does == compare entry entry?

the answer made for. given in documentation:

a == b returns logical array elements set logical 1 (true) arrays a , b equal; otherwise, element logical 0 (false) ...

to compare whole array, given in karakfa's answer, isequal can used. if want use ==, have use all this: all(v==w).


what matrix logical datatypes mean?

logical matrix matrix elements either true (1) or false (0) . in literature, referred boolean matrix or binary matrix.


how convert logical matrix matrix numeric datatype?

there several data types e.g. single, double, int64, uint64 etc. use function designated data type want convert into. read more here.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -