Replaces a number in a string, while preserving the string length.
Updated 7 Feb 2005

No License

A CSSM participant wanted to replace the numbers in a cellstring with another set of numbers, but he wanted the length of the cellstring to remain the same.

My solution to a CSSM question used RegExpRep and I thought it might be helpful to post it here so that the formatting is preserved and it's easy to read and use.

It was written for use with MATLAB version 6.5 through 7.0. The 'tokenize' parameter is included for the versions of MATLAB where "tokenize" is not the default behaviour. It will produce warnings in other versions.

The thread is available here:

Newsgroups: comp.soft-sys.matlab
Subject: String repair: poor form?
Message-ID: <h8yKd.2516$>

Cite As

Michael Robbins (2024). repfloat (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Characters and Strings in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes