"Jason " <firstname.lastname@example.org> wrote in message <email@example.com>... > "Sarah Hunt" <firstname.lastname@example.org> wrote in message <email@example.com>... > > "Juliette Salexa" <firstname.lastname@example.org> wrote in message <email@example.com>... > > > Thank you Steve, > > > but I don't have a clue what you mean by that. I said I haven't been using functions at all, which (I think) means all my code is 'script' already.. Please correct me if I'm wrong. > > > > > > "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com> wrote in message > You could make it a script (not function). > > > > Hi Juliette, Did you ever manage to find out how to fold your script? > > > Hey, an easy shortcut to folding your cold is to put whatever block you'd like to fold in a simple for loop > > For i=1 > %code code code; watch out for the usage of your loop variable i > end > > Then, assuming that you have a new enough version of Matlab, you can click + or - next to the for loop to hide the entire loop.
You CAN do this, but it is not something I'd advise. It makes your code more difficult to read. Why did I put that loop there? What does that end statement correspond to? It creates a spurious variable, here i. Worse, the variable i is already defined in MATLAB. So you may have just created an inadvertant bug.
Adding an extra for loop is silly, when you can do the same thing by putting %% comments before and after the block you might wish to fold. Then enable code folding for sections in the preferences pane for the editor.