Is there a shortcut key to comment multiple lines in matlab editor

17,724

Solution 1

The comment shortcut is CTRL+R on Windows and CTRL+/ on Unix systems (not sure about OS X). To comment multiple lines you'd have to highlight them using the mouse or SHIFT.

In any case this can be customized via Preferences -> Keyboard -> Shortcuts.

Solution 2

In Octave, Ctrl+R to comment and Ctrl+Shift+R to un-comment.

Solution 3

In Mac OS, Command + R to comment code.
Then, Shift+Command+R to un-comment.

Share:
17,724
Saeid
Author by

Saeid

Updated on June 04, 2022

Comments

  • Saeid
    Saeid almost 2 years

    Is there a shortcut to comment multiple lines in matlab. If there isn't can I create one?

    • Setsu
      Setsu almost 9 years
      What OS are you working on? Some shortcuts differ slightly between systems.
    • user8473076
      user8473076 over 6 years
      ...& Ctrl+T to un-comment.
    • The_Black_Smurf
      The_Black_Smurf over 6 years
      OP was looking for a way to comment multiple lines... not how to uncomment. I think your shortcut may still be relevant as a comment.
  • Hoki
    Hoki almost 9 years
    to add a little bit to that, you don't even have to select the full line(s) ... any line partially selected will get commented.
  • Sam Roberts
    Sam Roberts almost 9 years
    And Ctrl-T to uncomment.
  • Zoltán
    Zoltán almost 5 years
    In my case it's still Ctrl+R, even though I'm using Ubuntu (which is a UNIX system).
  • Mzq
    Mzq about 2 years
    uncomment on macOS by default is alt+command+/