From: Meedo on
"us " <us(a)neurol.unizh.ch> wrote in message <hv2gp6$mln$1(a)fred.mathworks.com>...
> "Meedo " <mohabedalgani(a)yahoo.com> wrote in message <hv204k$huk$1(a)fred.mathworks.com>...
> > Hi,
> >
> > How can i replace a char by another one using its index.
> >
> > e.g.
> >
> > s='matlab'
> > s1='a';
> > s2='A';
> >
> > How to replace only the first a (index 2 in the s string) with A, to be
> >
> > ans= mAtlab
> >
> > Does Matlab provides this kind of string indexing??
> >
> > i appreciate any comments..
> >
> > Mohammad
>
> one of the many other solutions
>
> s='matlab';
> r=regexprep(s,'a','A','once')
> % r = mAtlab
>
> us

Thank you for your reply.

but I was wondering how can i change the letter 'a' using its index

s='matlab2009a';


if i would like to change the 'a' in the index 11 (the third a). what should i do?

r=regexprep(s,'a','A','once') % does not support indexing

and
A(find(d='a',1)) = 'A'; % does not work or may be needs more clarifications


please any suggestions...


Thanks in advance