How do I interrupt execution of a Java method called using javaMethod() in MATLAB?
Mostrar comentarios más antiguos
I have a method in my Java class that prints "Hello World" in an infinite loop. The code is as follows:
class Hello
{
public static void main(String args[])
{
while(true)
System.out.println("Hello World\n");
}
}
I am running the above code as follows from MATLAB command prompt:
javaMethod('main', 'Hello', [])
The code runs fine but I am not able to interrupt the execution of main() by typing CTRL+C. Futher, implementing a KeyListener and calling System.exit(0) kills MATLAB as well.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deploy to Java Applications Using MWArray Data API en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!