How to put string concatenated in array

4 ビュー (過去 30 日間)
Joel Sande
Joel Sande 2016 年 4 月 21 日
編集済み: Joel Sande 2016 年 4 月 28 日
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 !

回答 (1 件)

Joel Sande
Joel Sande 2016 年 4 月 28 日
編集済み: Joel Sande 2016 年 4 月 28 日
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});

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by