Week+of+3-11+to+3-17

I am continuing this week where I left off on the straight line GUI. My first task to tackle will be the color-changing of the current line. I have to figure out how to make the function draw on a value that will contain the current color based on the button that is down in the button group in the top left corner. I originally scanned the GUI-governing script and was very confused as I couldn't find the functions for the callbacks of the buttons. Upon further investigation, I discovered that neither the buttons nor the button group had any commands in the script because GUIDE leaves the choices of which ones to use up to the user. Apparently, the buttons that are in a button group cannot have their functions be used, so I started by using the 'uipanel2 SelectionChangeFcn'. I added this to the script using the 'View' menu in GUIDE under the tab 'View Callbacks'. Then I had to figure out exactly what value I needed to be calling on in order to translate it to the proper color. I discovered a value called 'SelectedObject' in the Inspector for the button group. Shown below are two pictures that show a unique number value (essentially a handle) is given to each button in the group. I discovered that those numbers weren't "essentially a handle" - they actually are the exact handles of the buttons. So, I just needed to have the 'colorPanel SelectionChangeFcn' (I changed the Tag from uipanel2 to colorPanel) call the function, and then change the function to call on those handles. Below is the most recent copy of the function, with the newly changed lines pointed out with red boxes. With the color problem solved, my next step was to attempt to get the "Keep this line" and "Reset graph" buttons to work properly. I struggled for quite some time at figuring out how to get multiple lines to be able to be on the graph at once. I decided to separate the function into two parts, one that populates a dataset of the different lines, and one that graphs the lines when needed. The thing that really tripped me up was that I thought that I could just throw the x, y, and color variables into an array and then call different rows of that array out during the graphing process. After fully implementing this, working through some errors, and then being vexed by a set of errors later, I realized something. Just a standard array cannot hold vectors and strings both inside it. I needed a cell array. But once I solved that, I encountered massive problems in the GUI script. I can't figure out how to make that cell array remain the same across all the callback functions. After that long struggle to figure out how in the world to get the cell array to work, I realized a fundamental oversight I had been making the whole time: I was viewing this like one continuous program where a variable could be changed from command to command, but in fact it is just a group of functions that operate mostly independently of each other. So a variable created in one does not exist in the other. I also discovered that I cannot do what I'm used to in Java where I declare the variable outside the functions and then recall the same variable from function to function, because all the code in this script must be inside the functions. Finally, after a fair amount of digging on the Internet, I discovered the key to unlocking this chaos - the 'guidata' command. By using this command, I could store a new handle in the GUI data outside of the stuff that GUIDE created. This handle could be an access point for the cell array that I would use for storing the lines. It now all seems so obvious and plain, but this legitimately was not a conclusion that was staring me in the face. I started treating it as one of the handles and still ran into numerous problems. At this point, I have decided that I am in way over my head and this is too much for my brain to handle. I think I should step back now and take a simpler, albeit more sketchy approach to this problem of getting multiple lines to graph at once. But, my brain is so fried after hours of new ideas and debugging that I think it would be wise for me to wait until next week and attack it with fresh eyes.