-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.m
41 lines (27 loc) · 865 Bytes
/
example.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
%% get basic file info
clear; clc
fname = 'testGwaveform.h5';
fileinfo = rtxi_read(fname);
trial1 = getTrial(fname,1);
%trial2 = getTrial(fname,2);
%trial3 = getTrial(fname,3);
printParameters(fname,1);
%% browse a HDF5 file starting with a particular trial
clc
close all
rtxifig = rtxibrowse(fname,1);
% rtxifig2 = rtxibrowse('new',fname,2);
%% browse a HDF5 file starting with a particular trial, reusing a figure
% handle
rtxifig = rtxibrowse(rtxifig,fname,2);
%% add some data to the hdf5 file
% Running this section twice will produce an error.
file = H5F.open(fname,'H5F_ACC_RDWR', 'H5P_DEFAULT');
% add a dataset
dset = single(rand(10,10));
dset_details.Location = '/Trial1';
dset_details.Name = 'Random';
hdf5write(fname, dset_details, dset, 'WriteMode', 'append')
% get the dataset back out
hdf5read(fname,'/Trial1/Random')
H5F.close(file);