Does Matlab have the function to format script?

318 ビュー (過去 30 日間)
zzzhhh
zzzhhh 2016 年 6 月 10 日
回答済み: Julian Hapke 2023 年 12 月 11 日
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.

採用された回答

Walter Roberson
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
  1 件のコメント
Rayane Meghezi
Rayane Meghezi 2022 年 8 月 11 日
Thank you, seems to work well :D

サインインしてコメントする。

その他の回答 (4 件)

Azzi Abdelmalek
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
  2 件のコメント
zzzhhh
zzzhhh 2016 年 6 月 11 日
I didn't find any item in the context menu except smart indent that is related to code formatting as I mentioned in the question. Note that in my question the "format" does not refer to change of fonts, but more to proper addition of spaces and alignments.
Yash Mavare
Yash Mavare 2022 年 1 月 8 日
thank you

サインインしてコメントする。


Image Analyst
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
oren montgomery 2022 年 8 月 28 日
編集済み: Walter Roberson 2022 年 8 月 28 日
Its smiliar to ctrl+i but as a few more functions

サインインしてコメントする。


Florian Schanda
Florian Schanda 2021 年 4 月 13 日
編集済み: Walter Roberson 2021 年 4 月 13 日
You might want to have a look at https://github.com/florianschanda/miss_hit

Julian Hapke
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'))

カテゴリ

Help Center および File ExchangeHelp and Support についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by