How to make my gui editbox update my iterate calculations

Hi
Its a bit hard to explain, so I have uploaded a picture, and a video to youtube explaining what my problem.
I've uploaded my problem to youtube: http://youtu.be/19Aya05R6R8
My problem is that I need to make me iterate calculations show up in a editbox, during the calculation. But I've searched everywhere and haven't been able to find any help anywhere. So I need a gui matlab expert to help me.
I haven't found out what to do, the option of putting in a small break and then letting the small result appear in the editbox before starting again, ain't a good solution, because when I develop it, den it breaks down.

3 Comments

No sound and the picture is too small
Cant you choose HD and then select full screen? then on my computer I can see the picture fine.
I cannot get a clean view to this movie. I'm convinced, that youtube movies are not an efficient medium to explain Matlab problems.

Sign in to comment.

Answers (2)

You need to create a string with your numbers in it then send it to the correct control. Are you sure you're sending it to the edit box you want to, and not a tag or something?
strH = sprintf('H=%f', H);
set(handles.editH, 'String', strH);
Tell me what is the "Tag" property for your edit field that you want to put H into.
If that doesn't work, try adding
drawnow;
after it to force the screen to update immediately. It's possible you're just in such an intensive loop that it doesn't get around to updating the screen until your loop is done.

9 Comments

Hi, I'm not sure if I understand what you mean, my "tag" is result , where I want the H value to go into.
I just need to specify that I don't know what numbers will come out of H, its a series of calculations that iterates itself to a solution where there is equilibrium in the equation. In this case: soil bearing capacity equal to external force.
Then to send the value of H to the edit field called "result", do this:
strH = sprintf('H=%f', H);
set(handles.result, 'String', strH);
drawnow;
I've tried typing it into, but have I placed it correctly or? Because it didnt due anything.
function result_Callback(~, ~, handles)
% hObject handle to result (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
strH = sprintf('H=%f', H);
set(handles.result, 'String', strH);
drawnow;
Here it is in my dropbox, the function results is on line 1319
No. You said result was an edit box. You don't put this in the callback for the edit box. You put the code in whatever code you're running that changes the value of H. For example if you have a button called Go, and in the callback for Go, there is some loop that changes H all the time, then put that code in that loop.
have you confirmed that the callback is being invoked? Such as by putting in a breakpoint?
To "Image Analyst" if I put the code you given me under my calculation button that starts the iterative, it gives me H= in the editbox. If I then try to only leave the %f in the code, it gives me the H which it came to, from my last calculation before I stopped it. But it doesn't update it until I've stopped my calculation and started a new one.
To Walter Roberson:
Under my Calculation button their I've put a stop = -1 to start my calculation, I've tried before to set a 0.000001 sec pause which it then can update the Values that I want to get into my editbox, but that way resulted in a program freeze when I developed it. :/ I just need it to update the editbox like it does in the "Command Window"
Have you put a breakpoint in result_Callback to check that the callback is being invoked?
Walter, I've tried to put a break into my result_Callback but doesn't work, it only gets the H value when I stop the entire calculation. I don't know if you have been into the dropbox and seen for your self, but I'm a bit confused how to make this work, because my idea to make a small 0.00000 pause wasnt the right way, it froze my program when I tried to develop it.
Similarly how can I generate two variables in the same edit box say ' i out of n ' where i and n are variables inside a for loop.
Please help me. Thanks

Sign in to comment.

In your loop you must add for each edibox something like
set(handles.edit1,'string','Vd')

2 Comments

I've tried doing that, but it doesn't update my editbox with numbers in my gui, do I need to type something under the callback?

Sign in to comment.

Categories

Find more on Scope Variables and Generate Names in Help Center and File Exchange

Asked:

on 9 Feb 2013

Community Treasure Hunt

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

Start Hunting!