abfadddata
Adds data to be written. The data is grouped as part of the last created subcase, if any.
Syntax
R = abfadddata(fid, type, request, component, vector)
Inputs
- fid
- Integer representing the file ID.
- type
- A string containing the name of the data type.
- request
- A string containing the name of the data request.
- component
- A string containing the name of the data component.
- vector
- A vector containing the data.
Outputs
- R
- Numerical equivalent true/false.
Example
% Example abfadddata
file = 'c:/work/abftest.abf'
fid = createabffile(file);
abfsetversion(fid,11.0);
% Create the vectors for export. These must be declared as 'global'
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);
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