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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com