this is my code:
results = '';
for i = 1 : 1 : length(BBArray)
results = results + sprintf('%.0f\t' , BBArray(i, :))+'\n';
results + sprintf('%.0f\t' , BBArray(i, :))+'\n';
end
results;
how can i improve?

댓글 수: 2

Shrestha Kumar
Shrestha Kumar 2018년 6월 4일
What do you want to do with this code? You want to concatenate each row of the matrix to results??
yes i want this

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 4일

0 개 추천

You cannot use + to concatenate character vectors.
If you are using R2017a or later, you could change the initial
results = '';
to
results = "";
and that would have you working with string objects instead of character vectors, which would support using + for concatenation.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by