Using Java Robot class in Parfeval

Now I want to use Java Robot Class in a function. That function will be called by parfeval(), which will be evaluated in background.
  • It seems that Java robot class can not be used in parfeval().*
May I kindly know if there is a solution for this problem?

 Respuesta aceptada

Edric Ellis
Edric Ellis el 22 de Jul. de 2016
Editada: Edric Ellis el 22 de Jul. de 2016

0 votos

If you're referring to java.awt.Robot, then this will not work since the MATLAB worker executing the body of the parfeval function is a separate process. You might be better off writing some Java code to spawn a thread to drive the java.awt.Robot.

2 comentarios

Rick Han
Rick Han el 22 de Jul. de 2016
Thanks a lot for answering!
And actually, the parfeval seems not to recognize this command "robot=Robot()" or "robot = java.awt.Robot;" . This is the step to construct a java Robot object.
So you mean I need to write some codes to construct this object bu myself?
Thanks a lot!
Walter Roberson
Walter Roberson el 22 de Jul. de 2016
Possibly you need to import it, or make sure it is on the java class path?

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 22 de Jul. de 2016

0 votos

Each worker has its own process, and that process has no assigned graphics and no assigned keyboard or mouse. When you use the Java Robot class within that process, there is no keyboard or mouse to simulate presses of.

Categorías

Preguntada:

el 21 de Jul. de 2016

Comentada:

el 22 de Jul. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by