Working with functions
Introduction
When you import a function, a new variable is created for each of the function's outputs, and each output becomes a new column in your data set. You can use these new variables just like you use any other variable in your data set. However, variables that were calculated by functions also have some special properties that let you customize how Rave handles them.
Modeled Variables
When you import a function, you are given the option to define its outputs variable to be a new model of an existing variable in your data set. Regardless of what you choose, the output of the function will be added to your data set as a new variable. If you select a variable from the list, Rave will note that the selected variable and the new variable that you are creating are linked in the sense that they both represent the same physical quantity, though they may have different numerical values since they come from different sources.
Currently this linking does not affect Rave in any way.
In the future, you will be able to perform some special tasks with variables that are linked in this way.
Note: Whenever you create a surrogate model, it is automatically linked as a model of the variable it is based on.
Objective Functions
Objective functions can be created by clicking the "Create New Objective Fcn" button on the Model Tab. Objective functions are identical in all respects to other types of user-supplied functions; the only difference is that the "Create New Objective Fcn" gui comes with built-in templates that help you automatically generate code for these functions. Once they are created, however, Rave treats them exactly like any other user supplied function.
Function files created by Rave
Whenever you load a function into Rave that is not a .m MATLAB file, Rave creates a .m "wrapper" function that it calls in place of the function you specified. This function in turn calls the original file you specified in a way that is compatible with Rave.
- When you load a .txt function, the .m file that is created contains all the information that was in your .txt file. Rave does not use the .txt file, only the .m file. You can delete or move the original .txt file and it won't break Rave.
- When you load any type of function other than a .txt file or a .m file, Rave creates a new .m file to run the function, but it also uses the original file you specified and any other files that depend on this file. Make sure to keep all such dependent files in a place where Rave can find them.
See also: MATLAB search path