Most of Simulink actions is backed-up with a command-line code that does the same. I'm looking for a piece of code that throws me back to the previous block, exactly as the backward arrow.
Asked
Active
Viewed 187 times
1 Answers
2
Perhaps a bit of dirty hack but seems to work for me and I can't find a built in command to navigate back.
Since the keyboard shortcut for the back button is ALT+LEFT, I wrote this simple function to simulate that keypress.
I use the hilite_system
to try to grab focus on the simulink window
Filename: navigateBack.m
function navigateBack
import java.awt.*;
import java.awt.event.*;
rob=Robot;
hilite_system(gcb)
% ALT + LEFT :
rob.keyPress(KeyEvent.VK_ALT)
rob.keyPress(KeyEvent.VK_LEFT)
rob.keyRelease(KeyEvent.VK_LEFT)
rob.keyRelease(KeyEvent.VK_ALT)
end
If you run navigateBack
from the matlab command window, it does the same as pressing the back window in simulink.
![](../../users/profiles/2323393.webp)
scotty3785
- 5,062
- 1
- 21
- 32
-
-
Cool if it works, can you mark it as an accepted answer? (You can change later if someone comes along with a better answer) – scotty3785 May 22 '18 at 12:35
-