4.0

4.0 | 2 ratings Rate this file 57 Downloads (last 30 days) File Size: 1.69 KB File ID: #25064

extract substring

by Phillip M. Feldman

 

18 Aug 2009

substr extracts a substring of length len from the string str, starting at the specified offset.

| Watch this File

File Information
Description

substr extracts a substring of length len from the string str, starting at the specified offset. In this version, the first character position has offset 1. (In Acklam's original code, the first character position has offset 0, but this is inconsistent with Matlab conventions). If offset is negative, the position is reckoned by counting backwards from the end of the string. If len is omitted, substr returns everything to the end of the string. If len is negative, substr removes -len characters from the end of the string.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
06 Oct 2010 Zhiqiang Zhang

simple but nice code

05 Nov 2010 Jennifer Galt

Why can't this person bother using a standard help format, that includes an H1 line?

No matter, this is a trivial index operation.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
string Phillip M. Feldman 18 Aug 2009 12:42:27
substring Phillip M. Feldman 18 Aug 2009 12:42:28
substr Phillip M. Feldman 18 Aug 2009 12:42:28
substring UND 22 Sep 2011 12:07:05
substring nejc 22 Nov 2011 06:35:22

Contact us at files@mathworks.com