Systems Theory and Automatic Control

ADMITimportData
ADMIT documentation: ADMITimportData

ADMITimportData

ADMITimportData forms data in the general ADMITdata format used by the
toolbox. The source of the data can either be a file with comma or tab
separated table, other ADMITdata object or ADMITinfo and ADMITresults
objects. Also, data can be constructed from separate matrices provided
explicitly.

OPTDATA = ADMITimportData([OPTDATA_IN],FILENAME,[OPTIONS])
  Imports data from a file FILENAME or a structure that corresponds to
  the result of the function importdata(FILENAME).
  Following file format is expected:

    time,x1_lb,x1_ub,...,x[n]_lb,x[n]_ub
    Value_time,Value_x1_lb,Value_x1_ub,...,Value_x[n]_lb,Value_x[n]_ub
    . . .
    Value_time,Value_x1_lb,Value_x1_ub,...,Value_x[n]_lb,Value_x[n]_ub

  x[i] specifies the name of the ADMITvariable (should be the same in the
  task description and the data file). lb .. lower bound, ub .. upper
  bound

OPTDATA = ADMITimportData(OPTDATA_IN,VAR_NAMES,[DATATYPE],[OPTIONS])
  Copies the data that corresponds to the variable(s) VAR_NAMES in the
  ADMITdata object OPTDATA_IN of the specified type DATATYPE. 'Raw'
  datatype is taken as the default value.

OPTDATA = ADMITimportData([OPTDATA_IN],VAR_NAMES,TIME,LB,UB,[OPTIONS])
  Forms the data from given parameters explicitly. Only the data within
  the same time window can be generated. Length of the vectors TIME, LB
  and UB should be the same. If VAR_NAMES is a cell array of variable
  names, LB and UB will be matrices of height equal to the amount of
  variables listed.

OPTDATA = ADMITimportData([OPTDATA_IN],OPTINFO,[OPTIONS])
OPTDATA = ADMITimportData([OPTDATA_IN],OPTRESULT,[OPTIONS])
  Extracts the bounds on all variables from OPTINFO and OPTRESULT
  objects. Initial bounds in OPTINFO or OPTRESULT are generated as type
  'Initial', and estimated bounds on the variables of interest in
  OPTRESULT are generated as type 'Estimate'.

OPTDATA = ADMITimportData([OPTDATA_IN],OPTRESULT,'reuse',[OPTIONS])
  Extracts estimated bounds from OPTRESULT object and saves it as type
  'Raw' to use it as input data.

Inputs
  [...]       : square brackets notify that input is optional.
  OPTDATA_IN  : ADMITdata object, that will be included in the OPTDATA
                output, if present.
  FILENAME    : name of the file that contains data in correct format.
                  The header of the table should have the following
                  structure:
                  time,x1_lb,x1_ub,...,x[n]_lb,x[n]_ub
                  Where x1,...x[n] are the names of the variables, lb/ub
                  stand for lower and upper bounds correspondingly.
                  Data is listed in the same fashion, each line
                  containing the time instance and bounds on each of the
                  variables.
  VAR_NAMES   : string with the name of the variable or cell array of
                strings for several variable names.
  DATATYPE    : type of input data to be converted. Possible types that
                are supported: 'Raw', 'Processed', 'Initial', 'Estimate',
                'MonteCarlo'. Default value is 'Raw'.
  TIME        : row vector of time instances of the input data.
  LB          : vector or matrix of the lower bounds of the experimental
                data, should have the same amount of columns as the TIME
                row vector and the amount of rows equal to the number of
                variable names listed in VAR_NAMES
  UB          : vector or matrix of the upper bounds of the experimental
                data, should have the same amount of columns as the TIME
                row vector and the amount of rows equal to the number of
                variable names listed in VAR_NAMES
  OPTINFO     : ADMITinfo object, that contains initial information on
                the optimization taks. 'Initial' data can be extracted
                from it.
  OPTRESULT   : ADMITresults object, that contains the result of the
                estimation procedure. 'Initial' data as well as
                'Estimate' data can be extracted from it.
  OPTIONS     : ADMIToptions object, that contains options and
                preferences. Default options are used if this input is
                not provided.

Returns
 OPTDATA      : generated ADMITdata objects of the type 'Raw'.
                If OPTDATA_IN is provided as input, it will also be
                included in OPTDATA.

Examples

% Add data stored in matrices
% (note: you can use csvread,xlsread,... and other MatLab-functions to
% read data from CSV,EXCEL,... files!)
dataMean     = [1.5,1.9,1.3,1.7,2,1.6];
dataVariance = [0.15,0.2,0.15,0.1,0.15,0.1];
dataTime     = [0,1,2,3,4,5];
% assume lower/upper bounds to correspond to -/+ standard-deviation
dataLB       = dataMean - sqrt(dataVariance);
dataUB       = dataMean + sqrt(dataVariance);
% import
OPTDATA = ADMITimportData('x1',dataTime,dataLB,dataUB)
ADMITplot(OPTDATA,'x1')

% import data from file and add tolerances
% (note: make sure that the Carnitine-Shuttle example is accessible)
OPTDATA = ADMITimportData('./examples/CarnitineShuttle/carnitinedata.dat');
OPTDATA1 = ADMITprocessData(OPTDATA,'x1',[0:250],0.05)
ADMITplot(OPTDATA1,'x1')
OPTDATA2 = ADMITprocessData(OPTDATA,'x1',[0:250],0.05,0,'interpolate');
ADMITplot(OPTDATA2,'x1')