Import statement currently unsupported
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shankar Deka
el 7 de Ag. de 2017
Editada: Mohammad Shushtari
el 18 de Ag. de 2020
Hello, I am trying to use Java Robot Class inside a Matlab Function Block in Simulink to simulate key-press and key-release. But I keep getting an error while running the simulink model: "Import statements are currently unsupported." My code looks something like this:
function y = fcn(u)
import java.awt.*;
import java.awt.event.*;
rob=Robot;
rob.keyPress(KeyEvent.VK_A)
rob.keyRelease(KeyEvent.VK_A)
y = [0 0];
If I simply write the above as a function in matlab or as a script, it works fine. I get the error only when trying to do it with the simulink block. Is there any work-around to avoid this problem? Or any fixes? I am using Matlab version 2017a.
Thanks in advance! -SD
0 comentarios
Respuesta aceptada
Brian Hannan
el 8 de Ag. de 2017
If you're using this block for simulation only, you can use coder.extrinsic to get around this. There's a discussion on this here.
Más respuestas (1)
Adam Bazyl
el 19 de Sept. de 2017
Hello, could you show the code of the running program? Because I have the same problem but still have an error. Is that correct?
coder.extrinsic('import');
1 comentario
Mohammad Shushtari
el 18 de Ag. de 2020
Editada: Mohammad Shushtari
el 18 de Ag. de 2020
Hi, did you find the solution to this problem?
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!