This is minor. I was just doing the Matlab window tutorial and got the following error:
Error: Integers can only be combined with integers of the same class, or scalar doubles. (MATLAB:mixedClasses)
In linspace.m at 30
In hist.m at 94
In matlab_window_demo.m at 22
I figured out there are two reasons for this error: First, MWorks is making rand_var an int64 (or that’s how Matlab is seeing it at least). This still happens even if I define rand_var as an integer. I have to use MWorks’ rand() if I want Matlab to get doubles. This is a problem because the default bin centers for Matlab’s hist() aren’t integers, which causes the error. However, setting the bin centers to integers (1:10), I get a different error:
Error: First Input type not supported (MATLAB:histc:InvalidFirstNumericInput)
In hist.m at 119
In matlab_window_demo.m at 22
Apparently hist() doesn’t like int64 objects at all. So there are two solutions, ignoring the option of changing disc_rand() to rand() in the .xml file:
- Have the m-file recast to a double or an integer type that the function you want to use likes.
- Figure out a way to get MWorks to output a variable as a double even if the values are all (mathematically) integers.
I have no idea how difficult it would be to do #2, and it might break current functionality, so I’m guessing #1 is the better of the two.