Re: IF statement to check if it is a number or word
- From: "Steven Lord" <slord@xxxxxxxxxxxxx>
- Date: Wed, 15 Oct 2008 09:46:07 -0400
"Simon Luk" <simon.luk@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:gd3ui2$55i$1@xxxxxxxxxxxxxxxxxxxxx
Paul and Walter,
Thank you for your replies, one more problem I just came across..
['start_',a(1),'_end']
ans =
'start_' '1' '_end'
I want my ans to be actually this...
ans =
'start_1_end'
How would I go about doing that?
Since your a is a cell array you should index into it using curly braces
[like a{1}] to extract the contents of the first cell rather than extracting
the first cell itself for this application. When you concatenate a string,
a cell, and a string the result is a cell array with three cells -- the
first and third contain the two strings involved in your concatenation and
the second is the cell that was in the middle of your concatenation. That's
what your ans was. When you use a{1} instead of a(1), you're concatenating
together three strings (aka three char arrays) and the result is a
string/char array.
--
Steve Lord
slord@xxxxxxxxxxxxx
.
- References:
- IF statement to check if it is a number or word
- From: Simon Luk
- Re: IF statement to check if it is a number or word
- From: Paul
- Re: IF statement to check if it is a number or word
- From: Walter Roberson
- Re: IF statement to check if it is a number or word
- From: Simon Luk
- IF statement to check if it is a number or word
- Prev by Date: Normal Dist area under curve
- Next by Date: Re: Detect matlab version
- Previous by thread: Re: IF statement to check if it is a number or word
- Next by thread: Re: IF statement to check if it is a number or word
- Index(es):
Relevant Pages
|