Borrar filtros
Borrar filtros

Getting For loop Output On GUI

1 visualización (últimos 30 días)
mohamed
mohamed el 22 de Dic. de 2012
i have this loop code and on matlab i get the out i want but on GUI its not working.....
for nn=1:a
stri=character(nn);
stri=strcat(stri,':');
stri=strcat(stri,num2str(probabilities(nn)));
stri=strcat(stri,':');
stri=strcat(stri,num2str(codewords{nn}(length(codewords{nn}):-1:1)))
end
what i get on matlab:
:.234:0 1
A:.254:1101
C:.123:10001
D:.112:1001100
F:.234:0001110
but my problem is when i put it on GUI its keep getting me the last stri GUI out Put:
F:.234:0001110
which the last one i have on the stri
and im using this codes to get it on GUI :
nnn=num2str(stri);
set(handles.EditBox,'string',nnn)
i want to get every step that loop doing on GUI not only the final results
any help will be so grateful.....
Thank you

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Dic. de 2012
outstrings = cell(a, 1);
for nn=1:a
stri=character(nn);
stri=strcat(stri,':');
stri=strcat(stri,num2str(probabilities(nn)));
stri=strcat(stri,':');
stri=strcat(stri,num2str(codewords{nn}(length(codewords{nn}):-1:1)));
outstrings{nn} = stri;
end
set(handles.Editbox, 'String', outstrings);

Más respuestas (2)

mohamed
mohamed el 25 de Dic. de 2012
thank you Walter you are really the best just because you care enough to look and answer :)
i tried to put ur codes but when i did the editbox i made in the GUI gone :S and on matlab i got this
Warning: Single line Edit Controls can not have multi-line text
Warning: Single line Edit Controls can not have multi-line text
Warning: Single line Edit Controls can not have multi-line text
>>
:S thank you again
  2 comentarios
Walter Roberson
Walter Roberson el 25 de Dic. de 2012
set(handles.Editbox, 'Max', 2)
ngassa
ngassa el 26 de Mzo. de 2013
HI Roberson. i am new in matlab , and i habe a problem, can you help me please i have this loop code and on matlab i get the out i want but on GUI its not working.... for i= 1:n for j = 1:k(i) output (j) = d(i,j); end disp(output) end i want any value in a box, for example , when n = 8 , i have 8 boxes , and i want one value in one box. thank you

Iniciar sesión para comentar.


mohamed
mohamed el 25 de Dic. de 2012
OMG you are the best walter thank you so much and im sorry for bothering its working :D .......
thank you again.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by