Graph Bundle Tool - nickcounts/MDRT GitHub Wiki
Location: MDRT\ApplicationModules\PlottingEngine\plotTools\makeGraphBundle.m
The Graph Bundle Tool is a useful GUI to help concatenate graph structures into larger multilevel structures. Any number of graph configurations can be saved to a unique file name and then later compiled into one structure.
Graph Structure
To better understand the utility of the tool, the report generation idea must be understood. The ability to automatically define the characteristics of the plots needed for reports or data reviews, plots that employees know for a fact do not change between missions, would facilitate the process of analyzing the data. A user could then create graph configurations for their desired plots ahead of time. These configurations could be compiled into one larger structure title for example “FLS/HSS Post-Launch Data Review” and saved to the same folder. Regardless of mission, assuming the FD names remained the same, the large data structure could be plotted and churn out all necessary graphs.
So how is the graph structure concatenated? You can combine MATLAB structures of the same field, where each column or row refers to a different individual structure. In the example below, the fields remain the same across each configuration, but there are 6 different plots compiled into just one variable called graph. Calling the indexed graph(1), … graph(n) would plot that respective graph structure.
Part of the MDRT code is already compatible with this goliath of structures. plotGraphFromGUI reads the length of the graph structure and assigns this number to the variable graphNumber. The plotting code is then lumped into a for-loop that runs for each instance up to graphNumber. If a structure had 3 plots saved to it, graphNumber would be 3 and the plotting code would run 3 times. Within _plotGraphFromGUI _then, the code will always pull data from the indexed graph. Thus, if the time structure is desired, the code would call graph(i).time instead of just graph.time.
To continue this compatibility, the updateTimeAxesLimits is also compatible with these concatenated graph structures. As mentioned the case of Quick Plot does not need to worry about graph structures. However, if the Update Time Axes is called from a Plot Setup plot or anything derived from a graph structure, it is also passed the graphNumber along with the structure inside the appdata.
In the case of regular structures with only one configuration saved inside, the graphNumber is 1 so that works fine. Even if the graphNumber is larger than 1, the Update Time Axes treats the graphNumber as the indexed location of the relevant configuration in the larger structure ‘graph.’ This is relevant when a user hits “Save Graph Structure” from within the plot and is changing only one configuration within the larger ‘graph.’ Let’s say we change the x-axis limits for only the second configuration plotted and want to save the updates. graphNumber is 2, and thus the “Save Graph Structure” callback saves the new time information to graph(2).time.startTime and stopTime.
setTimeAxesLimits does not need to worry about this, as it only pertains to the creation and saving of individual graph structures. This would need to change if its parent code, makeGraphGUI, is edited to allow for tiered graph structure creation.
Graph Bundle GUI
Considering the graph structure functionalities, the Make Graph Bundle tool then visually allows for the creation of the multilevel graph structures. Previously, this operation could only be done within the command window and programmatically.
The various features and callbacks of the GUI are described in detail below.
Browse Within the tool, a user selects the folder holding their desired graph configuration .gcf files by pressing “Browse.” Only folders will show up within the new modal dialog box, and not any files themselves. Once the folder is selected, the listbox underneath “Available Configurations” populates with all available .gcf files.
More folders can be selected after the initial one. Thus, one file from the first folder may be added to the Selected Configurations, and another file from another chosen folder can also be added.
Add/Delete From there, the user can select the desired configurations and “Add” them to the listbox on the right under “Selected Configurations.” This listbox then represents all the currently selected .gcf files to be combined. If a file needs to be deleted from the Selected menu, the “Delete” button removes it from the listbox and the stored variables.
The stored variables include the file names (which also serve as what appears within the listboxes) and the file paths. Later, under “Save Structure” these files are loaded from their paths and then combined.
Clear All Clear all does just that and clears all the selected configurations from the listbox and the stored variables. This is akin to starting fresh.
Name Name serves as a default way of naming the saved file. Any string inputted into this field will then populate the file name within the modal dialog window. This can be changed within the dialog window as well.
Save Structure Pressing this pushbutton command allows the user to save the concatenated graph structure as a new .gcf file in their folder. The name of the file is automatically loaded as the “Name” input string but can still be edited before final saving.
It is within this callback, also, that the individual configurations are loaded and then concatenated. Each configuration is loaded into MATLAB from its path file, and then added on as the last element of a structure. As a result, the structure will grow to be the length of the number of files selected and thus loaded.
Plot Graphs “Plot Graphs” does just that and plots each configuration the user just uploaded to the new structure. There are two cases for this pushbutton to work.
The first case is that user has created a new structure in the same session, and presses “Plot Graphs” immediately after. In this case, the new graph structure is still active and stored in the workspace, and thus passed to plotGraphFromGUI.
The second case is the user loads the Make Graph Bundle GUI and immediately goes to “Plot Graphs” knowing that there is a concatenated structure already stored on his or her computer. In that case, the pushbutton callback opens a modal dialog window from where the user can select the configuration to print. The chosen .gcf file doesn’t need to be a multilevel graph structure but could be regular single level one too, seeing as the command is merely calling the plotGraphFromGUI function.
Also note, currently the Make Graph Bundle tool has no home. The GUI takes no inputs and has been called by typing _makeGraphBundle _from the command window. This can be changed with future updates, with another pushbutton added to the Plot Setup window, or the Review tool. On the other hand, this could even be incorporated into a separate tool for report generation entirely.