How do I make MATLAB automatically add closing quotation marks?

7 views (last 30 days)
When I type an opening quotation mark (or bracket), I often forget to add the closing quotation mark (or bracket). In some languages (such as R Studio), the program automatically adds the closing quote when we type the opening quote. Is it possible to do this in MATLAB (in both the script window and the command window)?
  1 Comment
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 14 Aug 2014
Jason it's an IDE capability.
Even if not, you may be able to download a different IDE such as CodeBlocks which I'm using for C++ and it does what you want, and it's supports several languages including MATLAB, so you can use CodeBlocks to write your code but then I don't know how you can compile your MATLAB code from CodeBlocks, I've never tried it.
Search in MATLAB preference or editor settings, maybe you find that, I've never saw such thing in MATLAB though.

Sign in to comment.

Answers (3)

Sean de Wolski
Sean de Wolski on 14 Aug 2014
No.
I'd suggest contacting tech support and letting them know you'd like this functionality.
  1 Comment
Image Analyst
Image Analyst on 18 Aug 2014
And how is the IDE supposed to know where the quote should end? Let's say the line of code is
str = 'this is some text; % initialize the string
You could make a guess that the ' should come before semicolon but not necessarily. Maybe it was supposed to come at the end of the line. There could be a huge number of ambiguities / uncertain situations.

Sign in to comment.


Star Strider
Star Strider on 14 Aug 2014
If you look closely, in the MATLAB Editor, a red underscore will appear at the end of a line with unmatched parentheses, brackets, quotes, missing commas in an argument list, and other such errors. It won’t close the quotes for you because it can’t guess what you’re thinking (consider the transpose operator).
It might be nice if the underscore was a bit more prominent, but once you remember to look for it, it can be quite helpful in alerting you to errors.

Jason
Jason on 18 Aug 2014
Thanks for your help, everyone!

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!