Comment out the rest of the code

6 views (last 30 days)
alpedhuez
alpedhuez on 29 Mar 2018
Answered: David Fletcher on 29 Mar 2018
Suppose I have a list of codes and I would like to comment out everything after line 100. Is there any way simpler thatn %{.....%}?
  2 Comments
Elias Gule
Elias Gule on 29 Mar 2018
Do you want automate the whole process? If so, you need to write a function that prepends '%' at the beginning of each non-empty after line 100 of your codes.
David Fletcher
David Fletcher on 29 Mar 2018
Not really sure it's any simpler (in truth, I'm not sure there's all that much that is simpler than %{ %}, but you can highlight the code and press ctrl R (all this does though is insert a % on every line)

Sign in to comment.

Answers (2)

Guillaume
Guillaume on 29 Mar 2018
* ctrl + G
* 100, enter
* ctrl + shift + end
* ctrl + R
whether or not it's simpler than %{ ... %} is up to you.
  2 Comments
alpedhuez
alpedhuez on 29 Mar 2018
can it be done with breakpoints?
Guillaume
Guillaume on 29 Mar 2018
Huh? breakpoints have nothing to do with code comments so I don't even understand the question.

Sign in to comment.


David Fletcher
David Fletcher on 29 Mar 2018
I suppose you could put in a double %% at line 100 to create a new section, and then just use the run section option on the previous section of code. Saying that, with your comment about breakpoints I'm not entirely convinced we're even talking about the same thing

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!