Suggestions+for+Programmer+of+CMS+GUI

Hello, Mr. Mysterious Programmer, the following page is my little attempt at throwing some ideas out there to refine your code and make the CMS GUI the best thing it could possibly be. I will begin by saying it's a quite fantastic program and it does some very cool stuff. I'm just here to try and help make something great even better. Another important note before I begin is that this program is in some ways above my level of MATLAB expertise, so I will try to make suggestions that are more in the realm of appearance, organization, and user-friendliness than in the methods you use in the hard code. What that also means is that I am aware that I might make some suggestions that are just not feasible code-wise and too large of an overhaul, and I apologize in advance for those. Without further adieu, I shall begin. I will progress through the code in order by line with attempts at splitting it into sections for ease of reading, and then at the end will make some general comments. Below is a hyperlinked table of contents for ease of navigating this page considering it is fairly long.


 * Preliminary GUIDE Stuff
 * Scatterplot Controls
 * Sdrawf
 * Spopf
 * Histogram Controls
 * BWetf
 * Hdrawf
 * Data Set Controls
 * Tpopf
 * Selection Controls
 * Fpushf
 * Fpopf
 * Save GUI Button
 * Selection Controls (continued)
 * Unknown Objects
 * LMpopf
 * Data Set Controls (continued)
 * ACf
 * DSf
 * Tfilterf
 * Cfilterf
 * struct2tablef
 * Hfieldsf
 * Sfieldsf
 * Ffieldsf
 * Checkboxes
 * ASf
 * NDcheckf
 * Selection Controls (continued again)
 * UFpushf
 * Final GUIDE Bit
 * My Extra Comments and Suggestions

=Preliminary GUIDE Stuff= If I am not mistaken, this code is all GUIDE-generated, so I don't need to address it at all. Back to top

=Scatterplot Controls= The first thing I have to say about this section is that I am aware that the callbacks and create functions for 'SXpop', 'SYpop', and 'SZpop' are all just placeholders generated by GUIDE, so I will not bother discussing them. The 'Spop' create function is also in the same boat. So, the two interesting things left to discuss are the callbacks for 'Sdraw' and 'Spop', which are entirely contained in 'Sdrawf' and 'Spopf'. Back to top =Sdrawf= I can't think of anything I would change about this function. Clearly well-thought-out and in-depth. Back to top

=Spopf= Obviously this script functions perfectly well, so there is no real need to change it, but I can't help but notice that it seems a tad bit inefficient. I can't quite come up with it, so maybe I'm wrong, but I feel like there's some way you could store arrays that would save you from having to fully type out each set statement. Maybe what I'm thinking is a separate function to use inside this which only types the group of set functions once and then takes inputs for the parameters from this function, making there only be one line of code under each part of this if statement. Back to top

=Histogram Controls= Once again the GUIDE default code dominates this section, and all the interesting discussion will happen in the sections below. Back to top =BWetf= This one's so simple it's impossible to criticize. Back to top =Hdrawf= I will not put the NDf function on this page because it is already far too crowded with pictures of code, but I must say NDf is a fantastic little piece of work, and I think it's a really cool feature that you added on, and I can't really ask you to change anything about Hdrawf either. Back to top =Data Set Controls= Once again the GUI code is extremely boring and repetitive, and I'm starting to wonder why I even bothered to put it all on this page. Below I discuss Tpopf, the only part of this section with really any of your work. Back to top =Tpopf= This is another one of the simple ones that I'm glad to say I fully understand and also cannot offer any changes. Very straightforward Back to top =Selection Controls= This is one section where I do have an actually serious piece of advice to offer. I feel as if the Hdrawf and Sdrawf calls here are a little overzealous. The user will likely often push the Fpush button without yet having graphed anything or with only having one graph active. In these cases, not only would the user be annoyed by the extra activity of the program and possibly get a little confused, a whole bunch of extra computing power is eaten up because if neither graph is currently up, neither one needs to get reset and Hdrawf and Sdrawf are very complicated functions that draw off of a huge data send and that both seriously tax the computer when they are run. So, I would suggest making a script, possibly called "redrawCheck" or something to that effect, which knows whether there is a graph currently up on each plot and only redraws where something is already graphed. If there is no way in the provided set of variables to keep track of whether there is a fresh graph on a given 'axes' object, I would suggest possibly adding a handle of your own to the GUI that stores a logical variable that is changed by Hdrawf and Sdrawf and then drawing off of it in the redrawCheck function. Back to top =Fpushf= This process goes entirely over my head, but it seems to operate perfectly so I can't really criticize. I guess maybe if other people are going to look at this in the future you might want to heavily comment it because if I recall correctly there are some commands in filterf (which I will not display in here for space's sake again) that I was unfamiliar with and could not quite intuitively tell what they were doing even with the help of your comments. So, I'm not sure what someone else would do if they had to refine these scripts in some way. Otherwise, the script displayed here is very fair to follow other than the fact I'm not quite sure what the find command does. Back to top =Fpopf= The comments combined with the code here make perfect sense and I don't have any issues with any of this. Back to top =Save GUI Button= Well done, very nice little feature for users to be able to save a certain bit of their handiwork. I was going to suggest this if you didn't have it already. Back to top =Selection Controls (continued)= This section in a way brings up one of my overarching concerns - a slight lack of organization. I'm not quite sure why this doesn't appear back up where the other bulk of selection-controlling objects did. Otherwise, this is a super unexciting bunch of GUIDE-generated code that's nothing to discuss. Back to top =Unknown Objects= I'm vexed as to what "Maxet", "LBpop", and "LMpop" are. Maxet must be some edit textbox for some kind of maximum, and LBpop and LMpop by your naming conventions are two popup menus for two very similar things to do with the greater-than/less-than popup menu in the selection tool, but I just cannot for the life of me figure out what they are. If they're objects from earlier versions that you have since gotten rid of, it would do anyone else who sees this code a great service for you to remove this section as to prevent confusion. Back to top =LMpopf= This function is called in the above section of mystery code but it's not in the folder with this GUI so I have even more reason to believe you abandoned these parts of the GUI. If not, make sure the next person gets a visible copy of this script. Back to top =Data Set Controls (continued)= Back to top =ACf= This function is so complex that it's not worth me discussing becuase it's extremely well done. I have to admit a bunch of the functions inside it are above my level of MATLAB, but I'm confident in saying you've done this section very well and it's not worth me sticking all the code in here. Back to top =struct2tablef= Although this one works just fine, I feel like there has to be a way to do this with a loop and an array full of the names. I guess the reason I say this is because I remember there being one or two other scripts in which you have these long lists of variable names being assigned to something and you might be able to stick the lists of titles into arrays that are stored in specific handles you create and then call those arrays each time rather than write the list out in multiple different places. Back to top =Checkboxes= I am once again wondering why I pasted all the MATLAB code in here as all the interesting stuff from this section is in the scripts below. Back to top =ASf= Nice catch here - definitely want the manual entry going blank when auto scale gets turned on. Back to top =NDcheckf= This is another case like the above Spopf where it could be simpler. You could make a string variable that is set to either 'on' or 'off' in the if statements and then have the set statements come after and have the final parameter be that string variable. Back to top =Selection Controls (continued)= Yet another straightforward spot in the GUI code. Back to top =UFpushf= Clever and simple way to do the reset to just perform the ACf command. That being said, this is another place, just like the Fpush button earlier, where there is a need for a way to see whether you should redraw the graphs or not. In fact, you could reuse the exact same function in both places if you made it. Back to top =Final GUIDE Bit= Nothing to say about this, but of course I copied in all of the code before I actually thought about the analysis. It was probably a waste of time to use put the whole GUI's worth of code in here. Oh well. Back to top =My Extra Comments= When all is said and done, I see just a few things that could be done here. One would be very simple - reorganize the code so that code for objects involved in data set changes are all in one place, code for objects involving selection changes (data cuts) are all in one place, code for objects to do with the histogram are all in one place, and code for objects to do with the scatter plot are all in one place. Then, commenting to emphasize this organization would make the code very readable. Another general suggestion is that if you are ever going to need someone else to get seriously acquainted with this code, get a little more verbose with your comments in the scripts you write because they can sometimes get confusing to follow. Especially, definitions of certain obscure MATLAB functions used would be nice because sometimes it is hard to differentiate between which functions are MATLAB's and which are yours, and also sometimes Google does not hold a simple path to figuring out how you've used a certain function. Additionally, if you're going to need someone to get familiar with this code, you might need to clean up your naming system. I saw your ideas for most of them but you weren't always consistent and sometimes the initials weren't very self-explanatory. I know for most of the objectsI had to hunt around GUIDE to figure out which code belonged to which object, so maybe the slight sacrifice of a little extra typing would be worth it if you made some longer, more obvious titles for objects. At this point it wouldn't be too bad because you could just use "find and replace." One thing that seemed to pop up a few times was the idea of storing an array in a handle that you section off so that it can be altered by one callback and used by another, or just so the same array can be used in multiple callback functions. I feel like this concept could serve you well if you were not familiar with it before. Finally, I have one general idea for if you're looking for a big project on making this GUI ridiculously awesome. Right now, you have the bottom-left quadrant for the histogram part and the bottom-right quadrant for the scatterplot part. My radical idea is that, just as a different choice in the scatterplot type menu changes which menus come up for axis selection, you could have a popup menu to choose on each side whether to have a scatterplot or a histogram. Additionally if you did this you would want to also have checkboxes for whether or not to apply a certain data set or a certain cut of data to one side or the other. This way the user could do a side-by-side comparison of two scatterplots, one before a cut and one after, or two histograms of the same variable from separate data sets, or other comparisons of that variety. I feel like that is the dream with this GUI if you are looking to take on a big project. All in all though, you've done a stellar job with this program and I'm totally impressed, and definitely couldn't have done it myself. Back to top