Prev: Locating indices of more than one of the maximum values of an array
Next: segmentation of image
From: lily on 3 Jul 2010 05:50 My question is how to use function regexprep to replace a whole string with a part of it. K>> str='a_b_c.3d.6';regexprep(str,'\w?_(\w+)_\w+?','$1') ans = b.3d.6 What I want is only ‘b’,how to define the pattern?Thanks.
From: ImageAnalyst on 3 Jul 2010 11:02 On Jul 3, 5:50 am, "lily " <mediocrity...(a)hotmail.com> wrote: > My question is how to use function regexprep to replace a whole string with a part of it. > K>> str='a_b_c.3d.6';regexprep(str,'\w?_(\w+)_\w+?','$1') > ans = > b.3d.6 > What I want is only b,how to define the pattern?Thanks. ------------------------------------------------- Wouldn't that simply be: str2 = str(3) or, underlinePositions = find(str == '_') str3 = str(underlinePositions(1)+1)
|
Pages: 1 Prev: Locating indices of more than one of the maximum values of an array Next: segmentation of image |