View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
% MATLAB Comment Stripping Toolbox

4.5 | 9 ratings Rate this file 16 Downloads (last 30 days) File Size: 5.32 KB File ID: #4645 Version: 1.0
image thumbnail

% MATLAB Comment Stripping Toolbox



18 Mar 2004 (Updated )

A small collection of utilities for stripping MATLAB comments from strings and files.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

This is a small collection of utilities for stripping MATLAB comments from MATLAB code. The code may be given in strings, cell arrays of strings, or read from a file or file identifier. There is full support for stripping comments from multi-line strings, that is strings with embedded newlines, which typically appear when an entire file is read in one go.


This file inspired Missingsemicolons and Remove Comments(Filename,Comment Indicator).

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
21 Feb 2017 Roman Müller-Hainbach

I will improve my rating once the missing feature of removing %{ ... %} multiline comments is added. Besides that it's fantastic.

06 Mar 2016 Al-Ismael Kiram

how to use this?

Comment only
02 Jul 2015 comm@ZeoN

Very effective.

28 Jun 2013 Rody Oldenhuis

Rody Oldenhuis (view profile)

Awesome, thanks :)

07 Apr 2012 Oleg Komarov

Oleg Komarov (view profile)

Ideal for matlab contests...

12 Nov 2009 Carlos Adrian Vargas Aguilera

Oh, besides of the NOT ignored lines after "...", also grouped comments are NOT ignored:

Comment only
12 Nov 2009 Carlos Adrian Vargas Aguilera

Great functions. Only my comments after a three points were left!

09 Oct 2009 Muhammad Arsalan

hi, very nice application. But when it works perfect up to line 277 after that it don't work as it supposed to work. There there anything that i can change?? like some memory limitations?? i need to use it on a file with 17000 lines. Any suggestions please.

29 Mar 2006 Scott Otterson

Useful. A bit out of date, though: With R14, I'm getting a many copies of this warning:

Warning: The 'tokenize' option for regexprep is now the default behavior. If I remove 'tokenize' it goes away.

27 Jul 2005 Balaji Rangaswamy

24 Mar 2004 Brett Shoelson

Excellent! This is regular expressions on steroids...makes quick work of comment stripping. Thanks, Peter.

Contact us