如何在 MATLAB 编辑器中重新格式化代码? [英] How can I reformat code in MATLAB editor?

查看:202
本文介绍了如何在 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 编辑器的一些默认格式快捷键 - 假设窗口

ctrl+A - 全选
ctrl+I - Smart Indend
ctrl+= - 全部折叠(循环控制语句)
ctrl+shift+= 展开全部(循环控制语句)
ctrl+] - 增加缩进
ctrl+[ - 减少缩进
ctrl+J - 换行评论

ctrl+A - Select all
ctrl+I - Smart Indend
ctrl+= - Collapse All (loop control statements)
ctrl+shift+= Expand All (loop control statements)
ctrl+] - Increase indent
ctrl+[ - Decrease indent
ctrl+J - Wrap comments

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

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

ctrl+R - Comment out selection (adds leading % to all selected lines)
ctrl+T - Uncomment selection (removes leading % from selected lines)
ctrl+K - Kill line (deletes from caret to end of line, if line is empty deletes newline)
ctrl+M - View or expand current message
ctrl+F1 - 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 编辑器中重新格式化代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆