Mercurial > forge
changeset 83:3bc6cfc87352 octave-forge
Put usage info in standard format.
author | alnd |
---|---|
date | Sat, 15 Dec 2001 22:01:28 +0000 |
parents | a3f7869a2f84 |
children | 7591a902ee4f |
files | main/io/textread.m main/strings/str_incr.m |
diffstat | 2 files changed, 38 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/main/io/textread.m Sat Dec 15 22:00:06 2001 +0000 +++ b/main/io/textread.m Sat Dec 15 22:01:28 2001 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2001 Albert Danial +## Copyright (C) 2001 Albert Danial <alnd@users.sf.net> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -14,31 +14,31 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -function [...] = textread(file, format, n); +## usage: [a,b,c,...] = textread(file, format, n); +## +## Reads data from the file using the provided format string. The +## first return value will contain the first column of the file, +## the second return value gets the second column, et cetera. +## If n is given, the format string will be reused n times. +## If n is omitted or negative, the entire file will be read. +## +## Example: say the file 'info.txt' contains the following lines: +## Bunny Bugs 5.5 age=30 +## Duck Daffy -7.5e-5 age=27 +## Penguin Tux 6 age=10 +## Columns from this file could be read with the line: +## [Lname, Fname, x, a] = textread('info.txt', '%s %s %e age=%d'); +## then, +## Lname(3,:) is 'Penguin' +## Fname(3,:) is 'Tux' +## x(3) is 6 +## a(3) is 10 +## +## Limitations: fails if the format string contains literal +## percent signs (ie, '%%'), or literal strings +## containing characters 's' or 'c'. - # [a,b,c,...] = textread(file, format, n); - # - # Reads data from the file using the provided format string. The - # first return value will contain the first column of the file, - # the second return value gets the second column, et cetera. - # If n is given, the format string will be reused n times. - # If n is omitted or negative, the entire file will be read. - # - # Example: say the file 'info.txt' contains the following lines: - # Bunny Bugs 5.5 age=30 - # Duck Daffy -7.5e-5 age=27 - # Penguin Tux 6 age=10 - # Columns from this file could be read with the line: - # [Lname, Fname, x, a] = textread('info.txt', '%s %s %e age=%d'); - # then, - # Lname(3,:) is 'Penguin' - # Fname(3,:) is 'Tux' - # x(3) is 6 - # a(3) is 10 - # - # Limitations: fails if the format string contains literal - # percent signs (ie, '%%'), or literal strings - # containing characters 's' or 'c'. +function [...] = textread(file, format, n); if ((nargin == 2) || n < 0) n = 0;
--- a/main/strings/str_incr.m Sat Dec 15 22:00:06 2001 +0000 +++ b/main/strings/str_incr.m Sat Dec 15 22:01:28 2001 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2001 Albert Danial +## Copyright (C) 2001 Albert Danial <alnd@users.sf.net> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -14,18 +14,19 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +## usage: [new_name] = str_incr(old_name, nLetters); +## +## Increments by one letter the substring comprising the first nLetters +## of old_name. The first nLetters may contain only characters in +## 'a'.. 'z'. +## +## Examples: str_incr("aa", 2) returns "ab" +## str_incr("ab", 2) returns "ac" +## str_incr("az", 2) returns "ba" +## str_incr("zz", 2) returns an overflow error +## str_incr("abcd", 2) returns "accd" + function [new_name] = str_incr(old_name, nLetters); - # [new_name] = str_incr(old_name, nLetters); - # - # Increments by one letter the substring comprising the first nLetters - # of old_name. The first nLetters may contain only characters in - # 'a'.. 'z'. - # - # Examples: str_incr("aa", 2) returns "ab" - # str_incr("ab", 2) returns "ac" - # str_incr("az", 2) returns "ba" - # str_incr("zz", 2) returns an overflow error - # str_incr("abcd", 2) returns "accd" letters = toascii(old_name); if (nLetters > size(old_name, 2))