views:

44

answers:

2

I have a MATLAB GUI I am working on and I would like to make a progress or status bar to show the user how long a certain script will take to run or where it is running relative to when it will finish.

I am new to this GUI thing, anyone have any ideas on how this could be done?

I dont understand any of the examples (aka don;t know how to add to my code) on MATLAB's file exchange.

Thanks,

ME

+6  A: 

The simplest answer is just to call waitbar. It is already in matlab, and will pop up a figure with a status bar that grows as you progress.

Of course, you can also download one of the many tools on the FEX, all subtle variations on waitbar. Or, you can use a text based bar, that shows up in the command window. Sometimes a text bar is what even I will choose.

If you really insist on programming your own tool that shows up in a figure window, it is not difficult. I did one of these recently, where the bar also changed color with progress of my algorithm. One might easily use the changing color to signify one piece of information, and the length of the bar as a second piece of information. So for example, an optimization might have the bar get longer with every iteration, and change color from red to green as the objective itself grows smaller.

As I recall, I simply created a textbox in my window, with the string something like: 'I''m thinking, get some coffee while you wait.' I then made the box invisible until it was time to start processing. Now, at each iteration, change the size of the box, and or the color that fills it. When done, make the box invisible again.

woodchips
A: 

GUI's consists of a visual part and the related code. Visual GUI components like 'Buttons' for example, are tied to a 'callback function', the code part. When you press a 'Button' an associated 'callback function' is executed. Programming a GUI in matlab means filling in your code in theses callback functions.

When your GUI Elements are well arranged with GUIDE, the visual editor, callback dummies for all used elements are generated. All you have to do is fill in your code, implementing the desired behavior.

When you worked through some basic GUI tutorials it might be a doable task to add a progress bar.

zellus
THANKS BUT I CAN'T VIEW THAT SITE...WORK! I have my GUI that I creadt in GUIDE up and working and it works great! Just the loic behind the progress bar is a little troublesome
dewalla

related questions