This sounds like a simple question. I have the following snippet:
target=strcat(string, ...
string2, ...
'suffix' );
A simple string concatenation written in multi-line. There are times I have to comment out intermediate text i.e. string2 with %. However doing this gives an error message: parse error at ')': usage might be invalid matlab syntax. Can someone help me on commenting out the middle line with alternative forms?
The line continuation command ... makes everything after it a comment, and (of course) makes MATLAB continue with the next line. So to comment out string2 in your function call, use ... instead of % to comment out.
With string2:
target=strcat(string, ...
string2, ...
'suffix' );
Without string2:
target=strcat(string, ...
... string2, ...
'suffix' );
To comment out part of a statement that spans multiple lines, use an ellipsis (...) instead of a percent sign. For example,
target=strcat(string, ...
... string2, ...
'suffix' );
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