Thread Subject: Extract an alphabet from a string?

Subject: Extract an alphabet from a string?

From: John Chow

Date: 22 Apr, 2008 21:10:04

Message: 1 of 3

How can I extract an alphabet from a string? For example,
I have a string

StrVar = 'abcde'

How can I extract the 2nd alphabet (which is 'b') from the
string? I remember that I was able to do it with
QuickBasic sometime ago but cannot find the comparable
command in Matlab.

Thanks.

John

Subject: Extract an alphabet from a string?

From: Bruno Luong

Date: 22 Apr, 2008 21:33:01

Message: 2 of 3

"John Chow" <nospam@mathworks.com> wrote in message
<fulk7c$7uv$1@fred.mathworks.com>...

>
> How can I extract the 2nd alphabet (which is 'b') from the
> string?

StrVar(2)

Bruno

Subject: Extract an alphabet from a string?

From: Dan Haeg

Date: 22 Apr, 2008 22:07:01

Message: 3 of 3

"John Chow" <nospam@mathworks.com> wrote in message
<fulk7c$7uv$1@fred.mathworks.com>...
> How can I extract an alphabet from a string? For example,
> I have a string
>
> StrVar = 'abcde'
>
> How can I extract the 2nd alphabet (which is 'b') from the
> string? I remember that I was able to do it with
> QuickBasic sometime ago but cannot find the comparable
> command in Matlab.
>
> Thanks.
>
> John

StrVar == char(98)

or

StrVar == 'b'

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com