Mercurial > hg > camir-ismir2012
annotate toolboxes/xml_toolbox/strsplit.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
rev | line source |
---|---|
Daniel@0 | 1 %function cstr = strsplit(strarr, ch) |
Daniel@0 | 2 % |
Daniel@0 | 3 % FUNCTIONALITY |
Daniel@0 | 4 % Splits string <strarr> at positions where substring <ch> |
Daniel@0 | 5 % occurs. If <ch> is not given, then ascii character 10 |
Daniel@0 | 6 % (newline) is the splitting position. |
Daniel@0 | 7 % This would split for example a read-in file into its lines. |
Daniel@0 | 8 % |
Daniel@0 | 9 % INPUT |
Daniel@0 | 10 % strarr string to split |
Daniel@0 | 11 % ch optional, character or substring at which to split, |
Daniel@0 | 12 % default is character ascii 10 = 'newline' |
Daniel@0 | 13 % |
Daniel@0 | 14 % OUTPUT |
Daniel@0 | 15 % cstr cell array of strings, all leading and trailing |
Daniel@0 | 16 % spaces are deleted. Substring ch is removed from string. |
Daniel@0 | 17 % |
Daniel@0 | 18 % EXAMPLES |
Daniel@0 | 19 % a = strsplit('aaa bbb ccc ', ' ') |
Daniel@0 | 20 % Result: a{1}='aaa', a{2}='bbb', a{3}='ccc' |
Daniel@0 | 21 % a = strsplit('user@server', '@') |
Daniel@0 | 22 % Result: a{1}='user', a{3}='server' |
Daniel@0 | 23 % a = strsplit('aabbccddeeffgg', 'dd') |
Daniel@0 | 24 % Result: a{1}='aabbcc', a{2} = 'eeffgg' |
Daniel@0 | 25 % |
Daniel@0 | 26 % RELATED |
Daniel@0 | 27 % strfun, depreciated stringify.m |
Daniel@0 | 28 |
Daniel@0 | 29 % Copyright (C) 2002 Marc Molinari, University of Southampton |
Daniel@0 | 30 % Author: Dr Marc Molinari <m.molinari@soton.ac.uk> |
Daniel@0 | 31 % $Revision: 1.1 $ $Date: 2005/04/15 17:12:14 $ $Tag$ |
Daniel@0 | 32 |