Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Test to see if Java code is running in Matlab

Subject: Test to see if Java code is running in Matlab

From: Carl

Date: 6 Aug, 2008 19:52:02

Message: 1 of 1

A colleague is developing some Java code for several related
 projects. I would like to use it in Matlab, but his code
has a few "features" that cause problems when I call it from
Matlab:
   1. It sets the system-wide look and feel, which causes
lots of Java null pointer errors on the console.
   2. It sets the default action on window close to "EXIT",
which quits Matlab, not just his class.

As it turns out, all I need to do is comment out three lines
of code and voila! It works great in Matlab, allowing me to
access tons of data that would otherwise be very difficult.
 My question is this: Is there a way to test if a Java
class is in the Matlab environment? If so, we could simply
wrap these troubblesome lines of code in an "if
(!runningInMatlab)" conditional and I could continue to use
the code as it develops without having to maintain my own
"Matlab-compatible" branch of code.

Thanks,
 - Carl

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us