Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make MATLAB ignore a section of code when auto-indenting?

I love MATLAB "smart indenting". Ctrl-A, Ctrl-I is hardwired with me. However, in my some-3000-lines script, I have one section of about 100 lines of code which I would like not to be touched by MATLAB.

(Why, you ask? That's why:

x = ...
        aaaaaaaaaaaaaaaaa ...
    - ...
        ( ...
                bbbbbbbbbbbbbb ...
            + ...
                cccccccccccccccccccccc ...
        );

That's my way of encoding that this is a difference of two things, one of which is aaaaaaaaaaaaaaaaa, the other being a set of parentheses, ... etc etc.

So, how can I teach MATLAB to not re-indent this part?

like image 292
bers Avatar asked Feb 02 '17 12:02

bers


Video Answer


1 Answers

You can use the %{ and %} for comment block:

a = 3;
b = 5;
%{
some other code to be ignored
%}

and if you want to toggle this ON, all you need is one more % in the right place:

a = 3;
b = 5;
%%{
some other code to be ignored
%}
like image 146
EBH Avatar answered Sep 22 '22 05:09

EBH