anon
anon

Reputation: 697

basic matlab help

matlab is acting weird. if I assign the value 202 to variable a and 207 to variable b then add a+b it gives me the correct answer 409. Now if I subtract a-b it gives me 0 instead of -5. btu if I do 202-207(not using the variables a and b ) it gives me -5.

what could be causing this?

edit: it gets even weird. I just noticed that matlab gives me a-b=0 only when I assign it the values 202 and 207 from a data matrix a=data(1,1),b=data(2,1). if I assign the values directly to a and b it acts normal

Upvotes: 2

Views: 167

Answers (1)

Amro
Amro

Reputation: 124563

a = uint8(202);
b = uint8(207);

>> a-b
ans =
    0

>> 202-207
ans =
    -5

Upvotes: 8

Related Questions