Showing posts with label Matlab initial configuration. Show all posts
Showing posts with label Matlab initial configuration. Show all posts

Thursday, January 3, 2019

Use your Java classes in Matlab

If you have Java classes which you want to use in your Matlab functions/scripts, you need to add the folders or the Java class themselves where they are saved into Matlab's Java class path.

Matlab's Java classpath is a list of folders which is automatically created at Matlab startup.
This list typically contains only folders of predefined Java classes which comes with Matlab itself.

To include additional Java classes, you need to:

  1. create a text file called javaclasspath.txt;
  2. insert on a line of that file the full path of the folder containing the Java class file or the full path of the Java class filename itself;
  3.  save such text file in Matlab's preferences folder.
Whether you need to include in the javaclasspath.txt file the full path of the folder containing a Java class file or the full path of the filename itself depends upon the type of Java class file. For example, for a Java class archive file (.jar file), you need to provide the full path of the filename itself. For more info, see the Matlab's online Help page about the Java class path or search Matlab's online Help for "Java class path".

To know what's your Matlab's preferences folder, type the command prefdir at Matlab's command line.


Friday, October 28, 2011

Matlab's graphical data tip precision

The graphical data tip in Matlab allows you to visualize the values of a point in a plot.
It comes with a certain decimal precision level already set as default (4 decimal digits).
You can change the default number of decimal digits.
See at the following Webpage,

http://www.cs.washington.edu/homes/dhalperi/useful.html

(thanks to Daniel Halperin for the suggestion).

2017 update

The previous instructions are valid for Matlab R2014a and older versions.
For Matlab R2014b and newer version, follow the suggestions from the following threads:

https://stackoverflow.com/questions/25477401/matlab-permanently-set-text-update-function-for-data-cursor-in-figures/39330765#39330765

Thanks to Michael Hirsch for pointing this out.

Saturday, April 3, 2010

Current work directory in Matlab at startup time

I use Matlab on a daily basis for the post-processing and preliminary visualization of my simulation datasets.

Every time I upgrade Matlab to a newer version I face the following issue:

when Matlab starts, the current work directory is set to a default value, inside Matlab directory tree itself.

This default directory is of no use for me. Usually, I prefer to have as current work directory at startup time the one with which I've been working most recently.

To setup your preferred current work directory at startup time, you just need to run once the command


userpath('my preferred current work directory')

Next time you run Matlab, it will automatically setup your chosen directory as the current work one.

If you run Matlab via an shortcut icon on your desktop, under MS Windows, just be sure that the "Start in" field of the shortcut is empty (see image below) otherwise the directory you chose and setup via the
userpath(...) command will be overwritten by the one inserted in the shortcut's "Start in" field.