How to make parentheses bold in a string?

How can I make statements in MATLAB with multiple parentheses more readable?

  • E.g.     maxSoernDepths = cat(1,maxSoernDepths,max(Soern(find(abs(Soern(:,1) - k))) < 0.0000000001),3); It's VERY VERY difficult to figure out which parentheses corresponds to which other parentheses

  • Answer:

    I haven't found a surefire way, but you can try a few things: To see which parentheses match, use the editor's syntax highlighting: delete a parenthesis and type it again; the matching parenthesis will be highlighted. Use 1-2 spaces outside each pair of parentheses. Breakdown similar statements to consecutive lines and use spaces to align the delimiters. (not in your case) Learn the order of execution of operators and don't use unnecessary parentheses. This may make the code more obscure however. Use an external text editor which does syntax highlighting by color coding. If you don't have performance or memory problems, breakup a long statement by using intermediate variables. This will help with code readability and debugging.

Achilleas Vortselas at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.