0

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.

Any idea?enter image description here

NoamG
  • 137
  • 9

1 Answers1

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.

scotty3785
  • 5,062
  • 1
  • 21
  • 32