abfadddata

Adds data to be written in an ABF file. The data is grouped as part of the last created subcase, if any.

Attention: Valid only with Altair CAE Readers and Writers Extension.

Syntax

R = abfadddata(fid, type, request, component, vector)

R = abfadddata(fid, type, request, component, vector, unittype, unit)

Inputs

fid
Integer representing the file ID.
Type: double | integer
type
A string containing the name of the data type.
Type: char | string
request
A string containing the name of the data request.
Type: char | string
component
A string containing the name of the data component.
Type: char | string
vector
A vector containing the data.
Type: vector
unittype
Type of the unit (this is optional).To get valid unit types, use getunittypelist.
Type: char | string
unit
Name of the unit (this is optional). Must be given if unit type is given. To get valid units, use getunitlist.
Type: char | string

Outputs

R
Numerical equivalent true/false.

Example

% Example abfadddata
file = 'abfexample.abf'
fid = createabffile(file);
abfsetversion(fid,11.0);

% Create the vectors for export. These must be declared as 'global'
timevar = linspace(0, 10, 10);
x1 = [1:10];
y1 = sin(x1);
x2 = [10:10:100];
y2 = cos(x2);

% Each pair will be grouped in a subcase (this is optional)
ret = abfcreatesubcase(fid, 'subcase 1');
if(ret == false) 
	error('Error creating subcase 1');
end

% Adds the 1st set of vectors to the above subcase and assigns required field names
abfadddata(fid, 'type1', 'req1','comp1',x1);
abfadddata(fid, 'type1', 'req1','comp2',y1);
abfadddata(fid, 'type1', 'req2','comp1',x2);
abfadddata(fid, 'type1', 'req2','comp2',y2);
% Set a custom time vector. Even though it is not mandatory
abfadddata(fid, 'Time', 'Time', 'Time', timevar); 

ret = abfclose(fid);
if(ret == false) 
	error('Error exporting data'); 
end

t = readvector(file,'subcase 1','type1', 'req1','comp2')
file = c:/work/abftest.abf
t = [Matrix] 1 x 10
0.84147  0.90930  0.14112  -0.75680  -0.95892  -0.27942  0.65699  0.98936  0.41212  -0.54402