How to put string concatenated in array

2 Ansichten (letzte 30 Tage)
Joel Sande
Joel Sande am 21 Apr. 2016
Bearbeitet: Joel Sande am 28 Apr. 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 !

Antworten (1)

Joel Sande
Joel Sande am 28 Apr. 2016
Bearbeitet: Joel Sande am 28 Apr. 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});

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by