How to convert all elements of a cell array to one string matrix.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Alan
el 7 de Oct. de 2013
Comentada: Alan
el 7 de Oct. de 2013
Imagine this Example:
A = {'Steve';'wonder';'Marcus';'Jacob'};
and i want to convert to
B =['1-Steve 2-wonder 3-marcus 4-Jacob'];
I'm doing that inside of an loop!
What is the best way to solve that? Thanks
0 comentarios
Respuesta aceptada
Sean de Wolski
el 7 de Oct. de 2013
A = {'Steve';'wonder';'Marcus';'Jacob'};
B = strjoin(strcat(cellstr(num2str((1:numel(A)).')),'-',A).',' ')
13a or newer for strjoin
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!