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
Related Q & A:
- I have a blog how can I make money with it.Best solution by Yahoo! Answers
- How can I make clay use to make things?Best solution by Yahoo! Answers
- How can I make my room look amazing when I clean it?Best solution by Yahoo! Answers
- How can I make it more likely that I will get a career in the acting industry?Best solution by Yahoo! Answers
- How can I print a picture out on multiple pages?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.