File Exchange

image thumbnail


version 1.0.0 (1.79 KB) by Kim Dohyun
remove comments from m-file or MATLAB code string.


Updated 11 Feb 2019

View License

Remove comments from m-file or MATLAB code string.

Remove the following comments:
1. Starts with %
2. Surrounded by %{ and %} (here, %{ and %} should be at the beginning of the line.
3. any text after three dots

If there is any comment style which is not handled in this code,
please contact to

Cite As

Kim Dohyun (2019). rmcomment (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Jos (10584)

There are some specific cases where this function fails ...
A = (1:3).'%this comment is not removed
B = "this %part of the string is removed"

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux