Main Content

loadDataFromMatFile

Load pulse data from a MAT file

Description

[Time,Voltage,Current] = loadDataFromMatFile(FileName) function loads pulse data from a MAT file.

[Time,Voltage,Current] = loadDataFromMatFile(FileName,Name,Value) function loads pulse data from a MAT file with additional options specified by one or more Name,Value pair arguments.

example

Examples

collapse all

This example shows how to add data to a Battery.PulseSequence object.

Create a pulse sequence object.

psObj = Battery.PulseSequence;
disp(psObj);

Load data from a file.

FileName = 'Synthetic_LiPo_PulseDischarge.mat';
[time,voltage,current] = Battery.loadDataFromMatFile(FileName);

Add the data to the pulse sequence.

addData(psObj,time,voltage,current);

Input Arguments

collapse all

Path or file name of the MAT file that contains the pulse sequence data.

Example: 'Synthetic_LiPo_PulseDischarge.mat'

Data Types: char

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: Battery.loadDataFromMatFile(FileName,'TimeVariable','myTimeVariable')

Use this value to specify the time variable to search for in the MAT file. If unspecified, the method searches for variables containing 'time'.

Example: Battery.loadDataFromMatFile(FileName,'TimeVariable','myTimeVariable')

Data Types: char

Use this value to specify the voltage variable to search for in the MAT file. If unspecified, the method searches for variables containing 'voltage'.

Example: Battery.loadDataFromMatFile(FileName,'VoltageVariable','myVoltageVariable')

Data Types: char

Use this value to specify the current variable to search for in the MAT file. If unspecified, the method searches for variables containing 'current'.

Example: Battery.loadDataFromMatFile(FileName,'CurrentVariable','myCurrentVariable')

Data Types: char

Output Arguments

collapse all

m-by-1 array of time data, in s.

Data Types: double

m-by-1 array of voltage data, in V.

Data Types: double

m-by-1 array of current data, in A.

Data Types: double

Version History

Introduced in R2016b