setting array to edittext with Matlab GUI

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 comentario

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' ?

Iniciar sesión para comentar.

Respuestas (1)

Adam Danz
Adam Danz el 29 de Abr. de 2019
Editada: Adam Danz el 30 de Abr. de 2019
(Continuing from comment section under the question)
No for-loop needed.
set(handles.edit8,'string',num2str(t))

2 comentarios

Adam
Adam el 30 de Abr. de 2019
I assume you meant num2str?
Adam Danz
Adam Danz el 30 de Abr. de 2019
Thanks, Adam. I made the correction.

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Preguntada:

el 29 de Abr. de 2019

Comentada:

el 30 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by