saving and retrieving string data in matlab

后端 未结 3 539
旧时难觅i
旧时难觅i 2021-01-25 00:24

Hi can any one help me in dealing with strings in MATLAB. For example, the string

A = \'A good looking boy\'

how can we store these individual

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 01:07

    As found here, you could use

    >> A = 'A good looking boy';
    >> C = regexp(A,'[A-z]*', 'match')
    C = 
        'A'    'good'    'looking'    'boy'
    

    so that

    >> C{1}
    ans = 
        A
    
    >> C{4}
    ans = 
        boy
    
    >> [C{:}]
    ans =
        Agoodlookingboy
    

提交回复
热议问题