필터 지우기
필터 지우기

Why is it helpful to use regions/sections while writing a script in matlab?

조회 수: 10 (최근 30일)
I was trying to make my script tidy and found out that it's possible to insert regions and sections in matlab scripts/functions. How are they correctly used? Why are they so helpful?
Thanks for your help :)
  댓글 수: 1
Adam
Adam 2017년 6월 23일
I'm not familiar with what a 'region' is, but I pretty much never use sections. Just personal preference, but to me they confuse the reading of code rather than help it. I don't write scripts often though except for quick initial exploration of ideas and having sections in a function seems odd to me.

댓글을 달려면 로그인하십시오.

채택된 답변

Stephen23
Stephen23 2017년 6월 23일
편집: Stephen23 2017년 6월 23일
Three good reasons:
  1. Code folding: https://www.mathworks.com/help/matlab/matlab_prog/improve-code-readability.html
  2. Run sections: https://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html
  3. Because using standard tools (default indentation, code sections, etc), makes code clearer and easier to understand. Code that is clearer and easier to understand is less buggy and easier to fix.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by