Align comments

Align comments in file, or all files in folder (and optionally their subfolders)

您现在正在关注此提交

Align comments in file, or all files in folder (and optionally their subfolders)
Before
After
Installation
Copy to MATLAB path ("C:\Users\{USERNAME}\Documents\MATLAB") to allow usage everywhere.
Usage
To format all files in active directory, just run "alignComments" in the terminal.
To format a specific file (or all files in a specific folder), "alignComments("FILE_OR_FOLDER_FULL_OR_RELATIVE_PATH")"
To format a specific set of files (or all files in specific folders), "alignComments({"FILES_OR_FOLDERS_FULL_OR_RELATIVE_PATH"})"
To format files without overwriting (output file will be created with the suffix "_new"), "alignComments({OPTIONAL_FILE_OR_FOLDER},'overwrite',0)"
To format files in subfolders as well, enable recursion by "alignComments({OPTIONAL_FILE_OR_FOLDER},'recursive',0)"
NOTE
While no trouble has been reported with the script, the author cannot guarantee that this script won't break your m files, so you are encouraged to use it first without overwriting, just in case the script parses the m file incorrectly and messes it up. In that case, the author suggests you reach out, so bugs/shortcomings can be addressed.

引用格式

Tanmay Chhatbar (2026). Align comments (https://ww2.mathworks.cn/matlabcentral/fileexchange/129514-align-comments), MATLAB Central File Exchange. 检索时间: .

标签

添加标签

Add the first tag.

一般信息

MATLAB 版本兼容性

  • 与 R2021b 及更高版本兼容

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.0

Now considers transposes, character arrays and string arrays smartly

0.972

No functional changes
Updated File Exchange image again

0.971

No functional changes
Updated File Exchange image

0.97

No functional changes
Better formatting
README update

0.96

Fixed a bug that incorrectly parsed inputs when given as a cell array

0.94

Suppress some output on terminal in some cases

0.93

Better help

0.92

Bugfix for 0.91

0.91

Improved detection of spaces, and alignment with the default comment line within MATLAB

0.90

Updated description

0.9