Using the Groovy API

Benefits of the API

Much of the code in the MATLAB API calls into the Groovy API to do the work. The Groovy API, in turn, calls the Java API.

There are just two classes of any significance in the Groovy API:

  1. WPlot - provides static methods to create plots
  2. WShell - provides static methods to load, compile and run Groovy scripts on-the-fly.

Note also the the Groovy script interpreter understands the Java language - if you know some Java you type that straight into a .groovy script.

The Groovy API is used only when constructing graphics elements. The additional overhead incurred by calling it will therefore generally be inconsequential. However, the Groovy language places demands on system resources. If you are specifically targeting mobile devices you may prefer to avoid using the Groovy API.

Compatibility

While the Groovy API recognises MATLAB style property/value pairs, it has no dependencies on MATLAB graphics. Support for Java in MATLAB figures may withdrawn in future MATLAB releases, but there is no obvious reason why this should effect code developed using the Groovy API.

For the widest compatibility, use Waterloo property names rather than those from MATLAB.