Returns the contents of a file with comments stripped.


Updated 1 Sep 2016

View License

Specify the name of a file and (optionally) the character indicator for a comment, and removeComments will return (in a cell array or a char) the line-by-line contents of the file without comments.

Cite As

Brett Shoelson (2023). removeComments(filename,commentIndicator) (, MATLAB Central File Exchange. Retrieved .

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

Inspired by: % MATLAB Comment Stripping Toolbox

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

Updated license