I have some function like this:
result = myfunc(arg1, ...
arg2, ...
arg3);
I wish to comment out arg2 and put in something else:
result = myfunc(arg1, ...
% arg2, ... <-- I get a red squiggly underline at the last dot
arg2b, ... <-- and under arg2b
arg3); <-- and under the closing parenthesis
But matlab won't let me put a comment in a line continuation, and all my Google searches turn up either multi-line statements, or multi-line comments, but not comments in a multi-line statement.
The error is "Parse error at : usage might be invalid Matlab syntax".
Is there a way to do this?
In reality the arguments are long filenames with full paths, and moving them up and out of the way makes the code really unreadable.
To add a single-line comment, just hold down the combo of keys shown above inside the code editor. Then the whole line you're on will be commented out. Just keep in mind that since everything will be commented out on that line, this only works for single-line comments.
It can span multiple lines. And it can even contain HTML! <p> This is a paragraph inside a multi-line comment. </p> --> Keep in mind that if you use multi-line comments, you will have to make sure you use the --> tag to close the comment. If you don't, the rest of the markup will be ignored and potentially break your page.
Any sentence, entry, clause, or phrase that requires more than one line can be continued in Area B of the next line that is neither a comment line nor a blank line. The line being continued is a continued line; the succeeding lines are continuation lines. Area A of a continuation line must be blank.
If an alphanumeric or national literal that is to be continued on the next line has as its last character a quotation mark in column 72, the continuation line must start with two consecutive quotation marks. This will result in a quotation mark as part of the value of the literal.
To comment out part of a statement that spans multiple lines, use an ellipsis (...) instead of a percent sign. For example,
result = myfunc(arg1, ...
... arg2, ...
arg2b, ...
arg3);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With