| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → SimBiology |
| Contents | Index |
| Learn more about SimBiology |
To be able to fit data to a model, the data must be in a dataset array, constructed by the dataset function. You can construct the dataset array at the command line, or import the data into the SimBiology desktop which constructs the dataset array for you.
Note If your data set contains dosing information that is infusion data, the data set must contain the rate and not an infusion time. |
Regardless of whether unit conversion functionality is on or off, dosing in the data file must be expressed in amounts (or as amount/time for infusion rate). By default Unit Conversion is off, so you must ensure that units for the data are consistent with each other. If you want to turn on unit conversion, see Unit Conversion for Imported Data and the Model.
Use the dataset function to import tabular data with named columns into an array that you can use in fitting and analysis at the command line. The dataset function lets you specify parameter/value pair arguments in which you can specify options such as the type of delimiter, and whether the first row contains header names. See dataset for more information.
% text files
data = dataset('file', 'Theophylline.txt', 'TreatAsEmpty', '.')% For Excel files
data = dataset('xlsfile', 'Theophylline.xls', 'TreatAsEmpty', '')You can also construct the dataset array from variables in the MATLAB Workspace.
% Create a 10x2 array
x = rand(10,2);
% Construct a dataset array containing x
data = dataset({x(:, 1), 'Column1'}, {x(:,2), 'Column2'})
If you import the data as separate variables containing doubles, you can construct the dataset array by concatenating the variables.
% Create 2 10x1 vectors
x = rand(10,1);
y = rand(10,1);
% Construct a dataset array containing x and y
data = dataset({x, 'Column1'}, {y, 'Column2'})
After you finish analyzing your data, you might have created new variables. You can export these variables to a variety of file formats. The Exporting Data section of the MATLAB documentation describes how to export data from the MATLAB Workspace.
The Importing Data section of the MATLAB documentation provides detailed information about supported data formats and the functions for importing data into the MATLAB Workspace. You can also import data using the MATLAB Import Wizard (see Using the Import Wizard in the MATLAB documentation). With the Import Wizard, you can import data as text files, such as .txt and .dat, MAT-files, and spreadsheet files, such as .xls.
The MATLAB Import Wizard processes the data source and recognizes data delimiters, as well as row or column headers, to facilitate the process of data selection and import into the MATLAB Workspace. You can import the data into the SimBiology desktop from the MATLAB Workspace.
In the SimBiology desktop, the import process constructs the dataset array for you, using one of the following:
A tabular text file
A Microsoft® Excel® spreadsheet
A MAT-file containing variables that are of double data type, or dataset object, time series objects, or a SimData object.
Variables that are in the MATLAB Workspace (for example, double, dataset object, time series objects, or a SimData object).
SimBiology project (.sbproj file) containing data
During import, you can specify whether the first row contains header information, and whether any characters in the file should be interpreted as missing values. You can also edit column headings and see a preview of the data (first 20 rows).
Note If you want to change the names of the column headers you must do so in the import dialog box. Once the data is imported you cannot change the names of the columns. |
Use the following tips to prepare the data before importing. This helps the import process to construct the dataset array in the SimBiology desktop.
Headers — The data file must contain only one row of headers. If the first row contains headers, it should immediately precede numerical data. Remove any comments from the file.
Header names — If the file contains header names, then the number of header names should equal the number of columns.
Delimiters — Text files must contain a consistent delimiter. Each row and column should have the same type and number of delimiters.
Missing data — In text files, specify missing data with a character, for example, a period. In Microsoft Excel files, leave cells representing missing data empty.
If you have already imported data into MATLAB, you can either continue to work at the command line or import the data into the SimBiology desktop for analysis. For information on when to use the command line or the desktop, see Using the Command Line Versus the SimBiology Desktop.
If the SimBiology desktop is not open, at the MATLAB command line type:
simbiology
Select File > Add Data > From MATLAB Workspace. The MATLAB Workspace Import dialog box opens with a list of variables that contain the accepted data types, and a preview of the data.

In the MATLAB Workspace Variables table, select the variables to import.
If the Data Type of the variable you wish to import is dataset, time series, or SimData object, you can select one variable containing the object.
If the Data Type of the variable you wish to import is double, you can select multiple variables to create the data set. Note the following:
The variables must each contain the same number of rows.
During import, the selected variables are concatenated column-wise.
The variables are concatenated in the order that they appear in the table, from top to bottom resulting in columns ordered from left to right.
If necessary, a matrix is transposed to create a matrix with compatible size.
The Size column shows the number of rows x number of columns in the variable.
If your data file contains missing values, the Data Preview table shows the missing values as NaN.
Double-click the cells in the first row of the Data Preview table to edit the names of the column headers.
The SimBiology desktop uses the names you specify in the column headers to:
Identify columns containing data used in fitting
Plot one variable against another during data exploration
Identify names in expressions when working with your data
Click OK. The SimBiology desktop adds the data to the Project Explorer under External Data, and opens the pane containing the data.
(Optional) Rename the pane containing the imported data set, in the Project Explorer:
Right-click the item representing the data set and select Rename Data. The Rename Data Set dialog box opens.
Specify a name for the data set and click Save.
If the SimBiology desktop is not open, at the MATLAB command line type:
simbiology
Select File > Add Data > From File. The Import Data from File dialog box opens.
Select a .txt file and click Open. The Text File Import dialog box opens. This dialog box lets you preview the data.

Under Column Separator, select the type of separator in the text file:
Select Auto-detect to let the SimBiology desktop detect and choose the separator.
If Auto-detect does not select the correct option, select one of the following options:
Comma Space Semicolon Tab Other
If you select Other, enter a character that represents the column separator.
If your data file does not contain header information in the first row, clear the First row contains header information check box.
If your data file contains missing values, specify the character used to identify missing values in the file. The Data Preview table shows missing values as NaN.
Double-click the cells in the first row of the Data Preview table to edit the names of the column headers.
The SimBiology desktop uses the names you specify in the column headers to:
Identify columns containing data used in fitting
Plot one variable against another during data exploration
Identify names in expressions when working with your data
Click OK. The SimBiology desktop adds the data to the Project Explorer under External Data, and opens the pane containing the data.
(Optional) Rename the pane containing the imported data set, in the Project Explorer:
Right-click the item representing the data set and select Rename Data. The Rename Data Set dialog box opens.
Specify a name for the data set and click Save.
If the SimBiology desktop is not open, at the MATLAB command line type:
simbiology
Select File > Add Data > From File. The Import Data from File dialog box opens.
Select a .xls file and click Open. The Excel File Import dialog box opens. This dialog box lets you preview the data.

If your data file does not contain header information in the first row, clear the First row contains header information check box.
If your data file contains missing values, the Data Preview table shows missing values as NaN.
Double-click the cells in the first row of the Data Preview table to edit the names of the column headers.
The SimBiology desktop uses the names you specify in the column headers to:
Identify columns containing data used in fitting
Plot one variable against another during data exploration
Identify names in expressions when working with your data
Click OK. The SimBiology desktop adds the data to the Project Explorer under External Data, and opens the pane containing the data.
(Optional) Rename the pane containing the imported data set, in the Project Explorer:
Right-click the item representing the data set and select Rename Data. The Rename Data Set dialog box opens.
Specify a name for the data set and click Save.
If the SimBiology desktop is not open, at the MATLAB command line type:
simbiology
Select File > Add Data > From File. The Import Data from File dialog box opens.
Select a .mat file and click Open. The MAT File Import dialog box opens with a list of the importable variables in the MAT-file along with their data type and size.

In the MAT-file Variables table, select the variables to import.
If the Data Type of the variable you wish to import is dataset, time series, or SimData object, you can select one variable containing the object.
If the Data Type of the variable you wish to import is double, you can select multiple variables to create the data set. Note the following:
The variables must each contain the same number of rows.
During import, the selected variables are concatenated column-wise.
The variables are concatenated in the order that they appear in the table, from top to bottom resulting in columns ordered from left to right.
If necessary, a matrix is transposed to create a matrix with compatible size.
The Size column shows the number of rows x number of columns in the variable.
If your data file contains missing values, the Data Preview table shows missing values as NaN.
Double-click the cells in the first row of the Data Preview table to edit the names of the column headers.
The SimBiology desktop uses the names you specify in the column headers to:
Identify columns containing data used in fitting
Plot one variable against another during data exploration
Identify names in expressions when working with your data
Click OK. The SimBiology desktop adds the data to the Project Explorer under External Data, and opens the pane containing the data.
(Optional) To rename the pane containing the imported data set, in the Project Explorer, right-click the item representing the data set and select Rename Data. The Rename Data Set dialog box opens.
Specify a name for the data set and click Save.
See the following sections for help on working with data in the SimBiology desktop.
| For information on ... | See ... |
|---|---|
| Identifying group and independent variables | Identifying Group and Independent Variables in the Data |
| Plotting data | Visualizing Data Using Plots in the SimBiology Desktop |
| Cleaning up the imported data | Excluding Rows of Data |
| Calculating statistics | Calculating Statistics for Imported Data |
See the following sections for help with creating models and fitting data at the command line or the desktop
| For information on ... | See ... |
|---|---|
| Creating PK models | |
| Fitting data |
![]() | Pharmacokinetic Modeling Functionality | Working with Imported Data in the SimBiology Desktop | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |