Home > Blockchain >  How to generate a string from a cell array
How to generate a string from a cell array

Time:11-01

I am trying to learn MATLAB. How can I convert this cell arraay:

  1×4 cell array

    {'A'}    {'B4'}    {'G6'}    {'D5'}

to this string:

    A -> B4 -> G6 -> D5 

CodePudding user response:

You can use strjoin to merge them into one string, with a delimeter ->

c = {'A', 'B4', 'G6', 'D5'};
str = strjoin( c, ' -> ' );
disp( str );

% 'A -> B4 -> G6 -> D5'
  • Related