Indent a block of code

97 ビュー (過去 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 Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by