Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: find a string from another string.
Replies: 4   Last Post: Nov 15, 2012 3:44 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Moon Datta

Posts: 34
Registered: 8/16/12
Re: find a string from another string.
Posted: Nov 15, 2012 3:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Nasser M. Abbasi" <nma@12000.org> wrote in message <k828de$f64$1@speranza.aioe.org>...
> On 11/15/2012 1:56 AM, Moon Datta wrote:
>

> >
> > This is a textdata{} , <288x1 cell>
> >
> > like
> > 'N6E01110926H08ASYWDCC2KYOTO'
> > 'N6E01110926H09ASYWDCC2KYOTO'
> > 'N6E01110926H10ASYWDCC2KYOTO'
> > 'N6E01110926H11ASYWDCC2KYOTO'
> > 'N6E01110926H12ASYWDCC2KYOTO'
> > 'N6E01110926H13ASYWDCC2KYOTO'
> > 'N6E01110926H14ASYWDCC2KYOTO'
> > 'N6E01110926H15ASYWDCC2KYOTO'
> > 'N6E01110926H16ASYWDCC2KYOTO'
> > 'N6E01110926H17ASYWDCC2KYOTO'
> > 'N6E01110926H18ASYWDCC2KYOTO'
> > 'N6E01110926H19ASYWDCC2KYOTO'
> > 'N6E01110925H00SYMWDCC2KYOTO'
> > 'N6E01110925H01SYMWDCC2KYOTO'
> > ..............................................
> > ...................................................
> >
> > like I have stated above.
> > As in the above cells in 13 number row there is H and SYM. The program will
> >give me those index number of the text data whose have the H ans SYM string in it.
> >Here it is 13,14.
> > Hope I am clear to you.
> >

>
> --------------------
> clear all
>
> data={'N6E01110926H08ASYWDCC2KYOTO'
> 'N6E01110926H09ASYWDCC2KYOTO'
> 'N6E01110926H10ASYWDCC2KYOTO'
> 'N6E01110926H11ASYWDCC2KYOTO'
> 'N6E01110926H12ASYWDCC2KYOTO'
> 'N6E01110926H13ASYWDCC2KYOTO'
> 'N6E01110926H14ASYWDCC2KYOTO'
> 'N6E01110926H15ASYWDCC2KYOTO'
> 'N6E01110926H16ASYWDCC2KYOTO'
> 'N6E01110926H17ASYWDCC2KYOTO'
> 'N6E01110926H18ASYWDCC2KYOTO'
> 'N6E01110926H19ASYWDCC2KYOTO'
> 'N6E01110925H00SYMWDCC2KYOTO'
> 'N6E01110925H01SYMWDCC2KYOTO'}
>
> f = @(c) numel([findstr('H',char(c)) findstr('SYM',char(c))])
> res = cellfun(f,data,'UniformOutput',false)
> find([res{:}]==2)
> ----------------------
>
> ans =
>
> 13 14
>
>
> --Nasser
>


Dear Sir,
Thanks a lot for your help.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.