Effacer les filtres
Effacer les filtres

Getting For loop Output On GUI

1 vue (au cours des 30 derniers jours)
mohamed
mohamed le 22 Déc 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
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 22 Déc 2012
What is character

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Déc 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);

Plus de réponses (2)

mohamed
mohamed le 25 Déc 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 commentaires
Walter Roberson
Walter Roberson le 25 Déc 2012
set(handles.Editbox, 'Max', 2)
ngassa
ngassa le 26 Mar 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

Connectez-vous pour commenter.


mohamed
mohamed le 25 Déc 2012
OMG you are the best walter thank you so much and im sorry for bothering its working :D .......
thank you again.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by