Tags: abc, cell, cellstr, cellstrc, char, character-type, defg, matlab, programming, variable

char to cell

On Programmer » Matlab

1,193 words with 1 Comments; publish: Tue, 29 Apr 2008 14:11:00 GMT; (20093.75, « »)

Hi,

I have a variable X with character-type variable.

S = ['abc '; 'defg'; 'hi '];

after using cellstr

c = cellstr(S);

I got

c =

'abc'

'defg'

'hi'

However, it is not exactly what I want because there will be a quote

in each cell of variable c.

Are there anyway to remove the quote sign in the cell variable?

Thanks

All Comments

Leave a comment...

  • 1 Comments
    • I guess that the last row is 'hik' (the same length as the first two

      rows)

      Does this help?

      ans =

      'abc'

      ans =

      abc

      On Jan 29, 5:42 pm, pete <pete....matlab.todaysummary.com.abcxxx.net> wrote:

      > Hi,

      > I have a variable X with character-type variable.

      > S = ['abc '; 'defg'; 'hi '];

      > after using cellstr

      > c = cellstr(S);

      > I got

      > c =

      > 'abc'

      > 'defg'

      > 'hi'

      > However, it is not exactly what I want because there will be a quote

      > in each cell of variable c.

      > Are there anyway to remove the quote sign in the cell variable?

      > Thanks

      #1; Tue, 29 Apr 2008 14:12:00 GMT