Code covered by the BSD License  

Highlights from
Line-wrap a string

5.0 | 5 ratings Rate this file 24 Downloads (last 30 days) File Size: 2.16 KB File ID: #9909 Version: 1.0

Line-wrap a string


Steve Eddins (view profile)


06 Feb 2006 (Updated )

Break a string into multiple lines

| Watch this File

File Information

The function linewrap.m wraps a single string into multiple lines by breaking it at word boundaries. The user can specify the desired maximum number of characters per line.


This file inspired Seis Lab 3.01 and Create And Output Montage Of Images.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
21 Jan 2015 Daniel Golden  
27 Nov 2010 Christine A.

Very useful, thanks for sharing

06 Mar 2009 matt dash

matt dash (view profile)

08 Feb 2006 urs (us) schwarz

for users: a great little helper that wraps your endless line into a nice little parcel (command line output/uicontrols)...
for programmers: look at the remarkable regular expression...

07 Feb 2006 urs (us) schwarz

nice exercise with regular expressions, it will get a 5/5 if it handles multiple white-spaces more consistently, eg, with a final DEBLANK(?)
moreover, a pointer to TEXTWRAP, which implements an only slightly different engine, would be nice

08 Feb 2006

Implemented suggestions from Urs: Use strtrim on the input string to remove leading and trailing whitespace; use deblank on output array to remove trailing whitespace; add cross-reference to textwrap.

Contact us