Working with incompatible data types

10 views (last 30 days)
I'm currently working with legacy code (MATLABv2012) with the most current MATLAB version (2013a). In the old code base many calculations of the following form were performed:
c = a + b
where "a" was an uint64 and b was a double. In my MATLAB version this produces following error: Error using + Invalid type of input arguments (should be uint64)
In old MATLAB Versions this was not an error. Is it possible to use the old behavior?

Accepted Answer

Walter Roberson
Walter Roberson on 7 Sep 2013
There is no problem in adding uint64 and double, so there must be something else going on. Please show some lines of code that reproduce the error.
>> uint64(532432234) + 3234.51
ans =
532435469
  6 Comments
Walter Roberson
Walter Roberson on 8 Sep 2013
R2013a on OS-X, the code gives me the expected numeric answer.
Please use
which -all plus
to check to see if you have an interfering plus() routine.
David
David on 9 Sep 2013
That was it. I had a eeglab implementation of uint64 in my path. Thanks!

Sign in to comment.

More Answers (2)

dpb
dpb on 7 Sep 2013
From
help uint64
"You can define your own methods for the uint64 class (as you can for any object) by placing the appropriately named method in an @uint64 directory within a directory on your path.
Type HELP DATATYPES for the names of the methods you can overload."

David
David on 7 Sep 2013
I'm sorry but your answer doesn't really answer my question. Are there any method definitions I can use that mimic the old behavior?
  1 Comment
dpb
dpb on 7 Sep 2013
If you mean a compatibility switch, afaik, no.
The way to make a method that mimics the previous is to write them it appears. I can find nothing regarding a change in behavior in the release notes and don't have other versions installed to test against for behavior different than 2012b.

Sign in to comment.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!