Does Matlab have the function to format script?
조회 수: 229 (최근 30일)
이전 댓글 표시
Just wondering if Matlab has the function to format script, e.g., automatically add a space after a comma, or add spaces before and after an "=" when I press semicolon at the end of a statement, or select a block of script to be formatted and press some button. Thanks.
댓글 수: 0
채택된 답변
Walter Roberson
2016년 6월 11일
No, MATLAB does not have that. Fortunately, David Varga recently mentioned releasing a beautifier; see https://github.com/davidvarga/MBeautifier
추가 답변 (4개)
Azzi Abdelmalek
2016년 6월 10일
Select your code, then right click with your mouse, you will see all possibilities you have. For example (ctrl+i) which is smart indent
Image Analyst
2022년 1월 8일
Type
control-a, to select all text in your editor window, then
control-i, to fix (properly align) the indenting of your lines of code.
댓글 수: 1
oren montgomery
2022년 8월 28일
편집: Walter Roberson
2022년 8월 28일
I made this tool a while back https://www.mathworks.com/matlabcentral/fileexchange/101604-automated-code-organizer?s_tid=srchtitle
Its smiliar to ctrl+i but as a few more functions
Julian Hapke
2023년 12월 11일
Here's a MATLAB snippet that depends on the undocumented tree2str and mtree, but produces a reasonable result:
tree2str(mtree(FILENAME, '-file', '-comments'))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!