Why does the timer object fail when I run MATLAB remotely through a text window?

I use telnet or ssh to log into a remote UNIX/Linux machine and run MATLAB on that machine. I only have a text-based window, and do not have X11 forwarding enabled for this connection (or I do not have an X-server running on my local machine).
When I run MATLAB, I see the following warning:
Warning: Unable to open display , MATLAB is starting without a display.
You will not be able to display graphics on the screen.
While running MATLAB, issuing a command such as FIGURE does not produce any output on the screen.
I then create a timer object and start it as shown below:
a=1;
t=timer('TimerFcn','a=5','Period',2,'ExecutionMode', 'fixedRate');
start(t)
The "TimerFcn" is never executed as I can verify by checking the value of the variable "a" at any point after the timer has been started. In other words, the following command typed at the MATLAB prompt:
a
will produce
a =
1
whereas it should return a value of 5 for "a", since I expect the "TimerFcn" to execute at least once at this point.

 Accepted Answer

This enhancement request has been incorporated in Release 14 Service Pack 3 (R14SP3).
For previous product releases, the ability to use the timer object and other XEvent based objects in MATLAB is not available when running MATLAB remotely in a text window with no X11 forwarding.
The workaround is to run MATLAB in an environment where the Java Virtual Machine (JVM) is available on the remote/host machine, and the local machine is running an X-server application. X11 forwarding must also be enabled for the connection to allow XEvent-based objects to work properly.

More Answers (0)

Categories

Products

Release

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!