report values from my m. files as they are running back to my gui

Hey, so I would like to be able to display iteration values and error next to each other in my gui as my m. file runs so that the user can see what iteration number the m.file is currently one and the level of error. Do i need to use a while loop in my gui m. file do update my text box continuously and use the handles format in my working m. file so that the info can be passed back and forth with out needing the working m. file to finish?
Thank you

2 Comments

I do not understand the question. Could you clarify it?
What error? If you get an error, it will throw an exception and create an error structure variable that will contain several pieces of information in it. If you want, you can catch it in a catch block and examine your iteration/loop variable at that time (before the function exits).

Sign in to comment.

 Accepted Answer

I am going to guess that when you speak of "error" you are referring to something like iteratively calculating the value of a series, with the "error" being the difference between the calculated value and the known value.
How is your code currently set up? Do you currently have a routine that calculates exactly one additional iteration and returns the current value, and then you call the routine again for the next value? If you do then you probably already have a loop calling that function, and the place to update the gui would be where that work function is being called. set() a static text uicontrol 'String' property to display the string. Be sure to call drawnow() after you set() the property, to give the screen time to refresh with the new text.
If your existing code just has a single routine with a loop that does the iteration calculation in-line, then that loop is the place you should be doing the set() and drawnow()

3 Comments

You are correct about what i'm calling error. sorry i'll make sure to clarify better next time.
for simplicity: GUI file, file2 = function file called by GUI file
file3s = function files called by file2
so my FUI file calls to file2 which then runs through multiple file3s. the error for each of file3s is then collected by file2 and once file2 is done send the results back to GUI file. i'm curious if i could send the handle for my text box from GUI file into file2 and then after file3s complete, have the text handle update itself and send the data back to the gui file with out stopping file2. file2 loops through file3s until the calculated error is minimized. just want the users to see that the program is working and how far it is from finishing.
Yes, there is no difficulty doing that. Just be sure to drawnow() after you set() the String property of the uicontrol.
You might want to consider using waitbar(), which is more useful with a "for" loop, but sometimes can be meaningfully used with "while".

Sign in to comment.

More Answers (0)

Categories

Products

Asked:

on 2 Oct 2013

Commented:

on 3 Oct 2013

Community Treasure Hunt

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

Start Hunting!