Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Inside the MATLAB Desktop

November 26th, 2007

Giving your code some privacy

In R2007b, code folding was introduced in the Editor for functions and help comments. I find this particularly useful for large M-files like edit.m, which have a lot of subfunctions. By collapsing all the folds in the file, I can quickly skim through the helper subfunctions.

foldededit.PNG

The Editor remembers which folds I had collapsed in each file, even between sessions of MATLAB, and I can choose to disable code folding if I wish from the preference panel:

codefoldingprefs.PNG

At this point, I know what all of you are saying– “Why does this only work for functions? I want to be able to fold all my MATLAB keywords!”. Don’t worry, I’ve already heard you, and that will be in a future release. In the meantime, try out our first version of code folding and let us know what you think!

4 Responses to “Giving your code some privacy”

  1. J.R.Menzinger replied on :

    That’s great!
    but… I’m waiting since 4 or 5 Releases for these option:
    SAVE BREAKPOINTS
    SAVE BREAKPOINTS CONDITIONS
    SAVE BOOKMARKS
    by leave the session.

    I think it should be easy to implement, isn’t it?

    Best Regards

    J.R.!

  2. Ken replied on :

    Hi J.R.,

    Your absolutely right! Saving breakpoints, breakpoint conditions and bookmarks are blatantly missing features.

    You can actaully save breakpoints and conditional breakpoints manually by doing the following:

    To save:

    >> mybreakpoints = dbstatus;
    >> save mydebugsession mybreakpoints

    To load:

    >> load mydebugsession mybreakpoints
    >> dbstop(mybreakpoints)

    We are currently working on more seamless ways to do this though.

    -Ken

  3. Will Dampier replied on :

    Personally, I love the new folding feature. I would love to see folding SWITCH statements since I often parse through dozens of input arguments to VARARGIN and they often take up 100 or more lines of particularly ugly code (try-catches, warnings messages, error messages, long conditional statements). I’ve started to put them into a large subfunction which modifies pre-initialized flag variables just so I can foldd it out-of-site but I don’t like habitually sharing variables between functions like that.

    Thanks
    Will

  4. Christina Roberts replied on :

    Hi Will,

    We will fold switch statements in a future release. Thanks for letting us know how you are using code folding!

    -Christina

Leave a Reply


Inside the MATLAB Desktop is written by the MATLAB Interface teams.

Team picture
  • Mike: Thanks Quan!
  • Quan: That’s a cool feature for the see also command. I just got the chance to check my google reader today,...
  • Mike: Harsha, On Windows, I use SnagIt to do the screen caps and annotations. Unfortunately its do not look so nice,...
  • Harsha: I would like to know how you got this kind of border for screenshots?
  • Mike: @Daniel, What are the keyboard shortcuts you use most often? What operations do wish there were shortcuts for?
  • Biswanath Senapati: I am using MATLAB tool for our work. Now I want to integrate matlab desktop (command window) in...
  • Ken: Hi John, I can appreciate your desire for a true Mac user interface. As a Mac user myself, I am constantly...
  • John Haitas: 7 years on… still no native graphics for the Mac. When will Mathworks take time to code a GUI...
  • Ken: Hi Daniel, Your absolutely right - keyboard shortcuts in MATLAB is an area that could use some improvement. Good...
  • Daniel Armyr: Hi. I am one of those old-school people who feels that the command-line has definate merit. However,...

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

Related Topics