Matlab and Java Tips


Oscilliscope for Matlab (not Simulink)

http://www.oscilloscope-lib.com/

Using Java in Matlab
Attention to various settings when using Java in Matlab.

  • Java Version – Matlab 7.0 e.g. needs Java byte code compiled with 1.4. To get the Matlab VM Version use version -java
  • To find the *.jar or *.class in Matlab use which classpath.txt and edit classpath.txt This settings is read once on Matlab startup.
  • JNI DLL Reference – For using Java Native Interface the compiled Native.dll needs to be referenced in Matlab too. Use edit librarypath.txt to add to the library path. This settings is read once on Matlab startup.

Common pitfall when using Java Code in Matlab

  • Especially arrays work different index in Matlab starts with 1, see here
  • java.lang.float == Double in Matlab – For a float[] array i needed to convert the value with double(float x) else i did not get a valid value for computation. Some of this is explained here.
  • Read input without wait from the keyboard in Matlabs main thread, here and see the related tutorial.
  • There is even a good blog for Matlab related tasks and problems

Tags: ,

Leave a Reply

You must be logged in to post a comment.