本文介绍了如何在 MATLAB 编辑器中重新格式化代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 MATLAB 编辑器中重新格式化代码?其他 IDE 通常有重新格式化或格式化选项来安排写入代码的位置.MATLAB的编辑器有吗?我用的是 MATLAB R2013a

How can I reformat code in MATLAB editor?Other IDEs usually have reformat or format option that arrange position of written codes.Does editor of MATLAB have it?I use MATLAB R2013a

推荐答案

Matlab 编辑器的一些默认格式快捷键 - 假设窗口

+ - 全选
+ - Smart Indend
+ - 全部折叠(循环控制语句)
++ 展开全部(循环控制语句)
+ - 增加缩进
+ - 减少缩进
+ - 换行评论

+ - Select all
+ - Smart Indend
+ - Collapse All (loop control statements)
++ Expand All (loop control statements)
+ - Increase indent
+ - Decrease indent
+ - Wrap comments

其他有用的 Matlab 编辑器键盘快捷键

+ - 注释掉选择(将前导 % 添加到所有选定的行)
+ - 取消注释选择(从所选行中删除前导 %)
+ - 终止行(从插入符到行尾删除,如果行为空则删除换行符)
+ - 查看或展开当前消息
+ - 显示功能提示

+ - Comment out selection (adds leading % to all selected lines)
+ - Uncomment selection (removes leading % from selected lines)
+ - Kill line (deletes from caret to end of line, if line is empty deletes newline)
+ - View or expand current message
+ - Display function hints

可以在 Prefrences>Keyboard>Shortcuts

Additional shortcuts can be found or defined in Prefrences>Keyboard>Shortcuts

最后要特别提到 ... 用于换行...
示例:

Finally a special mention to ... for line continuation...
example:

[output1,output2,output3]=calltoafunctionwithlotsofinputs(...
    intput1, input2, input3, input4, input5, ...
    'property1', propertyvalue1, ...
    'property2', propertyvalue2)

这篇关于如何在 MATLAB 编辑器中重新格式化代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 11:44
查看更多