Azzera filtri
Azzera filtri

Getting For loop Output On GUI

1 visualizzazione (ultimi 30 giorni)
mohamed
mohamed il 22 Dic 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

Risposta accettata

Walter Roberson
Walter Roberson il 25 Dic 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);

Più risposte (2)

mohamed
mohamed il 25 Dic 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 Commenti
Walter Roberson
Walter Roberson il 25 Dic 2012
set(handles.Editbox, 'Max', 2)
ngassa
ngassa il 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

Accedi per commentare.


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

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by