Warning: Parameter 1 to SyntaxHighlight_GeSHi::configureParser() expected to be a reference, value given in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/Hooks.php on line 207

Warning: Parameter 1 to SyntaxHighlight_GeSHi::resourceLoaderRegisterModules() expected to be a reference, value given in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/Hooks.php on line 207
Introduction to Coding Workspace Objects - Rave Documentation

Introduction to Coding Workspace Objects

From Rave Documentation
Jump to: navigation, search


The components of a Workspace Object

Note: Throughout this discussion I use “axes” as a singular noun meaning “the thing that gets created by MATLAB when you enter the command axes()”.

At a minimum, each graph must include 3 axes. Even though you only see one axes, there are actually 3 of them stacked on top of each other. Using multiple axes stacked on top of each other allows more formatting options, such as different colored gridlines. It also givs each graph 3 userdata properties, each of which is used by rave for a particular purpose. The 3 axes are:

  • handles.allgraphs(ai) = this is the main axes… the one in which you actually plot the data. The userdata of this axes
  • handles.fakeax(ai) = this is the next axes down. This axes doesn’t really do anything, but you can use it if you need to plot something at an intermediate layer. Important: The udata for your graph MUST be stored in this axes’s userdata property, i.e. set(handles.fakeax(ai),’userdata’,udata) and udata=get(handles.fakeax(ai),’userdata’,udata).
  • handles.fakerax(ai) = the bottom axes. This axes is used to display the graph’s background color and gridlines.

These three axes are created by the function ravenewgraph, which is ALWAYS run when the user makes a new graph and before your graph’s creation function is run. Thus these axes will already exist when your function gets run, so you don’t need to create these. You can access them using the fields indicated above.

IMPORTANT: Any plotting commands (e.g. plot,line,scatter,patch,surf,text) MUST take one of the above axes as a parent (unless you are making a matrix graph, described below). ALSO – BEWARE: many “high level” plotting commands will reset the userdata property of the axes. So you will need to set it again AFTER you finish plotting. For example, handles.allgraphs(ai)’s userdata should contain the keyword for your graph, something like “scatter”, but after you plot into the axes, it may get reset to an empty matrix. So check at the end of your graph creation function that it still says “scatter”. Otherwise rave won’t know which tabs to load when the user selects your graph (among other problems).

If you are making a matrix graph with multiple axes (I use “matrix graph” to refer to any graph that comprises multiple visible axes, regardless of whether they are actually layed out in a matrix), the 3 axes listed above will still be created. DON’T delete them, just make them invisible in your graph creation function, then create your own matrix of axes, EACH OF WHICH SHOULD ALSO STILL BE STACKED 3 high. Note: I recommend you use the position of handles.allgraphs(ai) to determine the boundary within which your graph matrix will be placed. See ravecreatescattermatrix.m for an example of how to do this.

Note: The “ai” (handles.activeindex) associated with each graph does not change when you delete a graph. If you have 3 graphs and you delete the second one, then you just have no graph with ai=2.