I have a vector, for example, (1,2,3,4) and I want to change the numbers into string

后端 未结 3 656
伪装坚强ぢ
伪装坚强ぢ 2021-01-23 05:29

I have a vector, (1,2,3,4) and I want to label 1 with \'AA\', 2 with \'AB\', 3 with \'CD\', 4 with \'Hello\', wh

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-23 06:11

    easy peasy, use a cell array, for example:

    v = {'AA','AB','CD','Hello'};
    

    then try,

    v{1}
    

    etc. (note the curly brackets...{})

    EDIT: this is parallel to :

    v{1}='AA';
    v{2}='AB'; ...
    ...
    

提交回复
热议问题