From: Rob Ing on 21 Mar 2010 15:13 I have designed a GUI, It gives me two files. an m-file and a fig file. If i input all of the values that i have assigned in the GUI layout editor in my m-file, can i then do away with the fig file?
From: Walter Roberson on 21 Mar 2010 15:32 Rob Ing wrote: > I have designed a GUI, It gives me two files. an m-file and a fig file. > If i input all of the values that i have assigned in the GUI layout > editor in my m-file, can i then do away with the fig file? Yes, you should be able to do that. You will, of course, need to change to call that opens the figure (and thus displays it) into a call that creates a figure and sets the appropriate size. I do not use GUIDE for the GUIs that I program, and have no associated fig file for them. I also hate all those "magic numbers" that appear when you use something like GUIDE.. e.g., if I want to change font size, I don't want to manually change hundreds of Position parameters. In order to make this work with as few "magic numbers" as practical, I created a small library of routines for automatic layout. One of the key routines takes a uicontrol and resizes it to fit around its content; the other key routine takes a uicontrol and moves it to a position relative to another uicontrol (e.g., 'outsidebottomright', 'insidetopcenter'). I have not had need to advance the library as far as designing "flow" (e.g., take these items and arrange them into an array in the available space), but what I do have helps enormously.
From: Rob Ing on 21 Mar 2010 18:14 Walter Roberson <roberson(a)hushmail.com> wrote in message <ho5s8c$sfi$1(a)canopus.cc.umanitoba.ca>... > Rob Ing wrote: > > I have designed a GUI, It gives me two files. an m-file and a fig file. > > If i input all of the values that i have assigned in the GUI layout > > editor in my m-file, can i then do away with the fig file? > > Yes, you should be able to do that. You will, of course, need to change > to call that opens the figure (and thus displays it) into a call that > creates a figure and sets the appropriate size. > > I do not use GUIDE for the GUIs that I program, and have no associated > fig file for them. I also hate all those "magic numbers" that appear > when you use something like GUIDE.. e.g., if I want to change font size, > I don't want to manually change hundreds of Position parameters. In > order to make this work with as few "magic numbers" as practical, I > created a small library of routines for automatic layout. One of the key > routines takes a uicontrol and resizes it to fit around its content; the > other key routine takes a uicontrol and moves it to a position relative > to another uicontrol (e.g., 'outsidebottomright', 'insidetopcenter'). I > have not had need to advance the library as far as designing "flow" > (e.g., take these items and arrange them into an array in the available > space), but what I do have helps enormously. Im not too sure what your talking about when you refer to "magic numbers"
From: Walter Roberson on 21 Mar 2010 18:59 Rob Ing wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <ho5s8c$sfi$1(a)canopus.cc.umanitoba.ca>... >> I also hate all those "magic numbers" that appear >> when you use something like GUIDE.. > Im not too sure what your talking about when you refer to "magic numbers" Suppose I have a calculation such as y = sin(7.83 * x + 1.81) then 7.83 and 1.81 are "magic numbers". Why was 7.83 chosen and not 7.82 or -Pi/7 ? Why 1.81 and not sqrt(3) ? Any time a number appears in code and there is no obvious explanation for why it should be exactly that number (e.g., in K = K + 1, the reason for the 1 is probably obvious), then the number is "magic" -- something that should be under suspicion of not being the right number (at least not under all circumstances), under suspicion of having been chosen arbitrarily, or because it was what made a few test plots "look nice". GUIDE generates code that is full of magic numbers for positions. Why should the x coordinate here be 34.8 instead of 34 or 35? Because that's where the user happened to drop the component when the user did the layout? But if so then chances are that the use dragged to a position partly determined by the font size that was in effect (e.g., dragged the width of a pop-up to fit a string). Making changes to the positions generated by GUIDE, such as to add a new line between two existing lines, requires a lot of work... work that will probably have to be redone the next time you want to make a change, or if you want to allow the user to resize the window.
|
Pages: 1 Prev: xlswrite; creating xlsm workbooks; xlsm extension Next: patch lighting and surface normal |