![]() |
RTXI 1.3
|
00001 function rtxifig = rtxibrowse(rtxifig,fname,trialNum) 00002 % rtxifig = rtxibrowse(rtxifig,fname,trialNum) 00003 % 00004 % INPUTS: 00005 % rtxifig - figure handle 00006 % fname - filename of HDF5 file you want to read from 00007 % trialNum = trial number from HDF5 file that you want to plot 00008 % 00009 % 00010 % OUTPUTS: 00011 % rtxifig - returns the figure handle that was used 00012 % 00013 % This function calls rtxiplot.m and creates an interface that allows you 00014 % to plot two different channels from the same trial of an RTXI HDF5 File. 00015 % Each axes is linked to its own listbox which contains all the available 00016 % channels. The time axis is automatically computed from the experimental 00017 % time step extracted from the HDF5 file. Double-clicking on a channel in 00018 % the listbox will replot that channel in a separate window. The interface 00019 % also lists all the parameters settings for each trial. The figure name 00020 % tells you what file the trial was plotted from and which trial you are 00021 % plotting. 00022 % 00023 % AUTHOR: Risa Lin 00024 % DATE: 10/31/2010 00025 00026 if (isscalar(rtxifig) && ishandle(rtxifig)) % re-use existing figure, needs 3 arguments 00027 if nargin == 3 00028 tag = get(rtxifig, 'Tag'); 00029 assert(~isempty(tag) && strcmp(tag, '__rtxiplot__'), ... % verify figure tag 00030 'rtxiplot:ArgumentTypeMismatch', 'An rtxiplot figure is expected.'); 00031 else 00032 error('You must have 3 arguments if you are specifying a figure handle: (rtxifig, filename,trialnumber)'); 00033 end 00034 else 00035 if nargin ==2 00036 trialNum = fname; 00037 fname = rtxifig; 00038 end 00039 rtxifig = rtxiplot('new'); 00040 scrsz = get(0,'ScreenSize'); 00041 % scrsz [left, bottom, width, height] 00042 set(rtxifig,'Position',[100 scrsz(4)/2 900 scrsz(4)/2]); 00043 end 00044 00045 fileinfo = rtxi_read(fname); 00046 figname = ['RTXI HDF5 Browser v0.1 | ',fname,' | Trial ',num2str(trialNum),'/',num2str(fileinfo.numTrials)]; 00047 set(rtxifig,'Name',figname); 00048 00049 trial = getTrial(fname,trialNum); 00050 00051 % Trial info: 00052 % parameters: [1x1 struct] 00053 % numParameters: 15 00054 % datetime: '2009-10-21T23:02:28' 00055 % exp_dt: 1.0000e-04 00056 % data_dt: 1.0000e-04 00057 % timestart: '10:01:29.6065' 00058 % timestop: '10:01:50.629' 00059 % length: 21.0225 00060 % numChannels: 3 00061 % channels: {1x3 cell} 00062 % data: [78813x3 double] 00063 % time: [78813x1 double] 00064 % file: 'dclamp.h5' 00065 00066 % This metadata is set as application data attached the figure. 00067 00068 meta.datetime = trial.datetime; 00069 meta.fname = trial.file; 00070 meta.numTrials = fileinfo.numTrials; 00071 meta.trialNum = trialNum; 00072 00073 for i=1:trial.numChannels 00074 rtxiplot(rtxifig,trial.channels{i}, trial.parameters, meta, trial.time, trial.data(:,i), 'k-'); 00075 end