Indent a block of code
显示 更早的评论
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.
采纳的回答
更多回答(2 个)
Image Analyst
2011-10-30
17 个投票
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
2021-1-8
5 个投票
You can also use smart indent
select code then 'ctrl I'
or
select code -> right click -> Smart Indent
1 个评论
Image Analyst
2021-1-8
I often just type control-a (to select all) and then control-i (to properly indent the entire file).
类别
在 帮助中心 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!