Borrar filtros
Borrar filtros

horzcat error while using ' '

1 visualización (últimos 30 días)
sermet
sermet el 28 de Mayo de 2013
names=['john'; 'ravi'; 'mary'; 'xiao']
howdy=char('10', '20', '30' ,'40')
result=[howdy, ' ', names] % ' ' in order to seperate columns
I wanna create result as
john 10
ravi 20
mary 30
xiao 40
but result=[howdy, ' ', names] gives horzcat error. How can I fix this?

Respuesta aceptada

Iman Ansari
Iman Ansari el 28 de Mayo de 2013
names=['john'; 'ravi'; 'mary'; 'xiao']
howdy=['10'; '20'; '30' ;'40']
result=[names repmat(' ',4,1) howdy]

Más respuestas (1)

Andrei Bobrov
Andrei Bobrov el 28 de Mayo de 2013
names={'john'; 'ravi'; 'mary'; 'xiao'}
howdy=(10:10:40)';
result = strcat(names,{' '},num2str(howdy));

Categorías

Más información sobre Time-Frequency Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by