Indent a block of code

조회 수: 80 (최근 30일)
Frank
Frank 2011년 10월 29일
댓글: Image Analyst 2021년 1월 8일
How do you indent a block of code? For example if you enclose a block of code in an if statement, and want to indent said block.

채택된 답변

Wayne King
Wayne King 2011년 10월 29일
In the MATLAB editor, you should automatically get identation of an if statement.
Other than that, highlight the text and do Text -> Small Ident, or Text -> Increase Ident

추가 답변 (2개)

Image Analyst
Image Analyst 2011년 10월 30일
Highlight the lines of text. Then hit tab to indent them a level to the right, and shift-tab to outdent them a level to the left.

Rachel Allen
Rachel Allen 2021년 1월 8일
You can also use smart indent
select code then 'ctrl I'
or
select code -> right click -> Smart Indent
  댓글 수: 1
Image Analyst
Image Analyst 2021년 1월 8일
I often just type control-a (to select all) and then control-i (to properly indent the entire file).

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by