필터 지우기
필터 지우기

How to put string concatenated in array

조회 수: 2 (최근 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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by