Hi, How do I writing all elements of t edit8?
n=3;
for j=1:n
t(j)=n+1;
end
for i=1:n
set(handles.edit8,'string',t(i));
end

댓글 수: 1

This section
n=3;
for j=1:n
t(j)=n+1;
end
is the same as this
t = ones(1,n) * (n+1); % t = [4,4,4]
So, you want the text string to be '4 4 4' ?

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

답변 (1개)

Adam Danz
Adam Danz 2019년 4월 29일
편집: Adam Danz 2019년 4월 30일

0 개 추천

(Continuing from comment section under the question)
No for-loop needed.
set(handles.edit8,'string',num2str(t))

댓글 수: 2

Adam
Adam 2019년 4월 30일
I assume you meant num2str?
Adam Danz
Adam Danz 2019년 4월 30일
Thanks, Adam. I made the correction.

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

카테고리

도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2019년 4월 29일

댓글:

2019년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by