Does Matlab have the function to format script?
234 次查看(过去 30 天)
显示 更早的评论
Just wondering if Matlab has the function to format script, e.g., automatically add a space after a comma, or add spaces before and after an "=" when I press semicolon at the end of a statement, or select a block of script to be formatted and press some button. Thanks.
0 个评论
采纳的回答
Walter Roberson
2016-6-11
No, MATLAB does not have that. Fortunately, David Varga recently mentioned releasing a beautifier; see https://github.com/davidvarga/MBeautifier
更多回答(4 个)
Azzi Abdelmalek
2016-6-10
Select your code, then right click with your mouse, you will see all possibilities you have. For example (ctrl+i) which is smart indent
Image Analyst
2022-1-8
Type
control-a, to select all text in your editor window, then
control-i, to fix (properly align) the indenting of your lines of code.
1 个评论
oren montgomery
2022-8-28
编辑:Walter Roberson
2022-8-28
I made this tool a while back https://www.mathworks.com/matlabcentral/fileexchange/101604-automated-code-organizer?s_tid=srchtitle
Its smiliar to ctrl+i but as a few more functions
Julian Hapke
2023-12-11
Here's a MATLAB snippet that depends on the undocumented tree2str and mtree, but produces a reasonable result:
tree2str(mtree(FILENAME, '-file', '-comments'))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!