Modeling integer types
Closed this issue · 2 comments
bbarker commented
Oddly, this isn't something I'd thought of in MATLAB until working with haskell-matlab. But unlike JavaScript, which only has a double type, MATLAB actually does have (sized) integer types:
>> class(5)
ans =
'double'
>> class(int8(5))
ans =
'int8'
>> isinteger(5)
ans =
logical
0
>> isinteger(int8(5))
ans =
logical
1
>> foo = [int8(5) int8(3)]
foo =
1×2 int8 row vector
5 3
>> class(foo)
ans =
'int8'
>> bar = [1:10]
bar =
1 2 3 4 5 6 7 8 9 10
>> bar(foo)
ans =
5 3
At the least, these do not currently have an MXArrayComponent
instance, but there may be other missing instances as well.
bbarker commented
It looks like it may actually be supported on haskell-matlab, though I'm having some issues understanding this code:
haskell-matlab/Foreign/Matlab/Array.hsc
Lines 273 to 306 in 4c57a51
bbarker commented
This appears to be working, though there are a few details of the hsc I still need to understand.