Week+of+3-25+to+3-31

For this week's post I will finish up the Straight Line GUI to round out the quarter. The last loose end I have on this program is the addition of popup dialogs to let the user alter the limits and steps of the sliders in the GUI. To go about this I first stumbled as I tried to find the 'dialog box' object in GUIDE, and then realized that of course it's not a GUIDE object. I had to use commands in the callback for another object to create a dialog. So, I decided a pushbutton was the only logical activator. I proceeded to create a pushbutton for each slider for altering the values that govern it. The challenge was ahead - actually getting the code to make everything work. I mostly followed the example provided in Chapter 12 of the book, although I decided that fiddling with the options was unnecessary in my situation. The two values of steps are in an array together in the handles, but I chose to make them two separate boxes in the input dialog for simplicity of the user's understanding. This made a couple tricky spots in the programming, and caused me to trash my first model for the callback because it made conversions between numbers and strings too long-winded, especially when combining and separating the array. Another tricky spot to get around with the steps was the values themselves that the program uses. The two values in the SliderStep array are for proportions of the bar, not specific values to move up and down, so in order to switch between what the program wants and what makes sense to the user, I needed to often multiply or divide by the length of the slider (the distance between min and max). The final phase of my programming once I got the input dialogs to work was to add in a few error catches. After some hunting, I found a command called 'warndlg' that pops up a dialog with some text displayed and only one button: "ok". I used the 'warndlg' command to display messages to the user when they did something that was not allowed. There are three instances of this: on all sliders, when the minimum is greater than the maximum; on all sliders, when one of the steps is greater than the length of the slider; and on the two radius sliders, when the minimum is less than 0. In all of these instances, the entering of the numbers has no effect aside from inciting the program to display the warning dialog. Below is a video of this new functionality at work.

http://screencast.com/t/vFtXktSAo

With the specifics of that ironed out, which was more easier said than done, I was finally satisfied with the abilities of my humble little straight line program. It has taught me a number of valuable MATLAB lessons that I have a feeling will help me get a jump start in college. The function has not changed since I posted pictures of it last week, and neither has any of the functionality displayed in last weeks video, but I now feel comfortable finishing off the quarter by taking the time to throw up a final copy of the GUI script's code. Below is the full body of the code of the script governing my straight line GUI.