Model Browser User's Guide    

Data Loading Application Programming Interface

Data Loading API Specification

You can use the data loading API (application programming interface) to write your own data loading function, plug these functions into the toolbox, and subsequently use data loaded by these functions within the toolbox. To allow this, there are several stages that need to be followed as described below. For an example, see xregReadConcerto.m (in the mbctools directory).

Data Function Prototype

A function to successfully load data has the following prototype:

Input Arguments

filename is the full path to the file to be loaded.

protoOut is an empty structure with the fields expected in the return argument out. This allows the data loading API to be easily extended without the need for data loading functions to change when MBC changes.

Output Arguments

The first return argument, OK, allows the function to signal that it has successfully loaded the data file. A value of 1 signals success, and 0 failure. If the function fails, it can return a message, msg, to indicate the reason for the failure. This message is displayed in a warning dialog box if the function fails. If the function is successful, the return argument out contains the data necessary for MBC.

out.varNames is a cell array of strings that hold the names of the variables in the data (1 x n or n x 1).

out.varUnits is a cell array of strings that hold the units associated with the variables in varNames (1 x n or n x 1). This array can be empty, in which case no units are defined.

out.data is an array that holds the values of the variables (m x n).

out.comment is an optional string holding comment information about the data.


  MBC Modeling Data Function Check In