JuliaInterop / JuliaInterop/MATLAB.jl

Better anticipate Matlabs behavior regarding integer vs float values?

Open
#211 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Julia
Stars
286
Forks
64
PR merge metrics
No merged PRs in 30d

Description

This took me a while to figure out:

If I send data from Julia to Matlab, integer values from Julia will be cast as the corresponding integer values in Matlab. However, using Integer values in Matlab is relatively rare as per default everything is a double.

This can lead to some unexpected errors, because Matlab e.g. refuses to compute something like this:

[int64(1) int64(2)] .* [2,3]
Error using  .* 
Integers can only be combined with integers of the same class, or scalar doubles.

Not sure what the best solution here would be though. At the very least I would stress in the readme that every Julia variable that is supposed to be used by Matlab should be defined as a float, i.e. 1.0 instead of 1 unless the Matlab code specifically asks for integers.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README and the Julia-to-MATLAB data-conversion path described in the issue. Verify how integer and floating-point values are represented on the MATLAB side, then determine whether the documented resolution is sufficient. Done means the integer-versus-double behavior and the recommended handling are clearly explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, matlab
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.