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

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

A few default formatting shortcuts for the Matlab editor - assuming windows

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>键盘>快捷方式

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天全站免登陆