Borrar filtros
Borrar filtros

How to put string concatenated in array

2 visualizaciones (últimos 30 días)
Joel Sande
Joel Sande el 21 de Abr. de 2016
Editada: Joel Sande el 28 de Abr. de 2016
Hi everyone, I have a problem with string concatenation. Hard to explain : I concatenate strings, I put them in array : Error.
% New_time(i) = strcat(num2str(H_to_Update(i)),' ',num2str(M_to_Update %(i)),' ',num2str(S_to_Update(i)),' ', num2str(Milli_to_Update(i)));
% New_time{i} = strcat(num2str(H_to_Update{i}),' ',num2str(M_to_Update{i}),' ',num2str(S_to_Update{i}),' ', num2str(Milli_to_Update{i}));
I don t know which one to use. The error change when I use bracket or parentheses. I attached the 2 File so you can run the function.
Thanks a lot !

Respuestas (1)

Joel Sande
Joel Sande el 28 de Abr. de 2016
Editada: Joel Sande el 28 de Abr. de 2016
Here is the answer. I just saw my little mistake 2 days ago (see attached .m and .txt files to run it if you wish).
New_time{i} = strcat(num2str(H_to_Update(i)),' ',num2str(M_to_Update(i)),' ',num2str(S_to_Update(i)),' ', num2str(Milli_to_Update(i)));
fprintf ('%s %s %s %s %s %s \n', num2str(Neighboor(i)), num2str(Action(i)), num2str(Neuro_Abun(i)), num2str(Length(i)), num2str(Delay(i)), New_time{i});
fprintf (fid, '%s %s %s %s %s %s \n', num2str(Neighboor(i)), num2str(Action(i)), num2str(Neuro_Abun(i)), num2str(Length(i)), num2str(Delay(i)), New_time{i});

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!

Translated by