Ken & Mike on the MATLAB Desktop

July 23rd, 2007

Just give me a new line!

Typing several commands to run at the command line can be tedious and hard to read. After typing in several long commands, the text scrolls way over and it is hard to see exactly what has been typed. In the example below, I typed several commands to generate the quiver plot.

shiftenter1.jpg

To make the code easier to read and to make MATLAB wait while you type more commands, hit shift-enter as you enter commands. This adds a new line in the Command Window without executing the code that has already been typed. Another advantage of using shift-enter to type commands in the Command Window is that the commands are added to the Command History as separate commands instead of as one big command.

shiftenter2.jpg

This example is from the 3-D Demo, Quiver section.

5 Responses to “Just give me a new line!”

  1. Steve Eddins replied on :

    Hey, that’s a good one. I didn’t know about that!

  2. Markus replied on :

    If you change the grid in x or y in your example, you will have to repeat all the following commands one by one to get the plot updated. In my opinion it would be better to have all the lines as one big command in the command history.

  3. Kristin replied on :

    Markus - My example may not the best. I am sure there are times when one approach will be better than the other. I’m just trying to show that the option exists.

  4. Ravi replied on :

    This is an off topic question.
    Is it possible to just select a few variables of interest in the workspace browser window and hide the rest? This way, I can monitor and change them without getting distracted by the others.
    It would be nice to be able to at least drag the variables of interest to the top of the window.
    This is perhaps not a “must have” facility. I just felt that it would be convenient to have it.

  5. Kristin replied on :

    Hi Ravi,

    I’ve forwarded your comments to our developer for the Workspace browser to consider for a future release.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Ken & Mike work on the MATLAB Desktop team.
  • DP: Hi i have a problem with ezplot3, i want to plot more than i curve in the same graph but hold on command...
  • Ken: Hi Arsalan, Unfortunately there is no way to get the new Editor API in older versions of MATLAB. -Ken
  • Arsalan: Hi, I am very excited about the MATLAB API for editor because right now i am working on a project and i need...
  • Johannes: Since I started using matlab-emacs some days ago I never experienced Emacslink. But I experienced some...
  • Francisco J. Beron-Vera: Hi all, I have recently learned about ViEmu (http://www.vimemu.c om) which, for Vi/Vim...
  • OysterEngineer: When I first learned of the Publish feature in MatLab, I thought it might be useful to help to...
  • Ken: Hi Herve, I’m not quite sure what you mean by “stand-alone&# 8221; mode? -Ken
  • Herve: I wonder when the publish fonction will be supported in standalone mode.
  • Mike: Ravi, What you described should work as far I understand it. Please follow up with technical support. With a...
  • Mike: @Daniel, Thanks for that note.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.