Code covered by the BSD License  

Highlights from
Line-wrap a string

5.0

5.0 | 4 ratings Rate this file 26 Downloads (last 30 days) File Size: 2.16 KB File ID: #9909

Line-wrap a string

by

 

06 Feb 2006 (Updated )

Break a string into multiple lines

| Watch this File

File Information
Description

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.

Acknowledgements

This file inspired Seis Lab 3.01.

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 (4)
27 Nov 2010 Christine A.

Very useful, thanks for sharing

06 Mar 2009 matt dash  
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...
us

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
us

Updates
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