Home > vbmeg > functions > gui > preAnalysis > meeg_processor > utility > timeseries_viewer > vb_timeseries_viewer_plot_trigger_data.m

vb_timeseries_viewer_plot_trigger_data

PURPOSE ^

plot trigger data

SYNOPSIS ^

function [obj] = vb_timeseries_viewer_plot_trigger_data(obj, window_from, window_to)

DESCRIPTION ^

 plot trigger data
 [USAGE]
    [obj] = vb_timeseries_viewer_plot_trigger_data(obj, window_from, window_to);
 [IN]
    obj : vb_timeseries_viewer object.
 [OUT]
    obj : vb_timeseries_viewer object.

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [obj] = vb_timeseries_viewer_plot_trigger_data(obj, window_from, window_to)
0002 % plot trigger data
0003 % [USAGE]
0004 %    [obj] = vb_timeseries_viewer_plot_trigger_data(obj, window_from, window_to);
0005 % [IN]
0006 %    obj : vb_timeseries_viewer object.
0007 % [OUT]
0008 %    obj : vb_timeseries_viewer object.
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 %
0014 % --- Previous check
0015 %
0016 if ~exist('obj', 'var')
0017     error('obj is a required parameter.');
0018 end
0019 
0020 %
0021 % --- Main Procedure
0022 %
0023 
0024 H = obj.H;
0025 
0026 cla(H.trigger_axes);
0027 
0028 % Remove previous legend
0029 if isfield(obj, 'ext_legend_handle')
0030     try
0031     delete(obj.ext_legend_handle);
0032     catch
0033     end
0034 end
0035 if ~isempty(obj.trig_ch_list_plot_ix)
0036     freq    = vb_continuous_file_get_sample_freq(obj.trigger_obj);
0037     [obj.trigger_obj, trig_data, from, to, read_ch_name] = vb_continuous_file_get_sample(obj.trigger_obj, ...
0038                                                        obj.trig_ch_list(obj.trig_ch_list_plot_ix), ...
0039                                                        ceil(freq*window_from), ceil(freq*window_to));
0040     if ~isempty(trig_data)
0041         % plot trigger
0042         step = 1;
0043         t  = [from-1:to-1]/freq;
0044         ix = [1:step:size(trig_data,2)];
0045         obj.handle_ext_lines = ...
0046                 plot(H.trigger_axes, t(1:step:length(t)), trig_data(:, ix));
0047 
0048         % Plot legend
0049         l_h = legend(H.trigger_axes, read_ch_name);
0050         try
0051         set(l_h, 'FontSize', 10.5, 'FontUnit', 'points');
0052         catch
0053         set(l_h, 'FontSize', 10.5);
0054         end
0055 %        set(l_h, 'FontUnit', 'normalized');
0056 
0057         % set position
0058         obj.ext_legend_handle = l_h;
0059     end
0060 
0061 
0062 
0063 % trigger onset
0064 %    Ntrial = length(obj.trial_list);
0065 %    ymax = max(trig_data(:));
0066 %    ymin = min(trig_data(:));
0067 end
0068 
0069 % set(obj.figure, 'CurrentAxes', H.trigger_axes);
0070 % axes(H.trigger_axes);
0071 % for k=1:Ntrial
0072 %     t = obj.trial_list(k);
0073 %     patch([t.onset, t.onset, t.onset, t.onset], ...
0074 %                            [ymin, ymin, ymax, ymax], ...
0075 %                            [0.2, 0.2, 0.2]);
0076 %
0077 % end
0078 
0079 % Set Label(should be done after plotting)
0080 % h = xlabel(H.trigger_axes, 'Time[sec]', ...
0081 %                         'FontName', 'Times', ...
0082 %                         'FontUnit', 'points', 'FontSize', 14);
0083 % set(h, 'FontUnit', 'normalized');
0084 %
0085 % h = ylabel(H.trigger_axes, 'External trigger', ...
0086 %                        'FontName', 'Times', ...
0087 %                        'FontUnit', 'points', 'FontSize', 14);
0088 % set(h, 'FontUnit', 'normalized');
0089 %
0090 % % Set Axis font
0091 % set(H.trigger_axes, 'FontName', 'Times', ...
0092 %                     'FontUnit', 'points');
0093 % set(H.trigger_axes, 'FontSize', 14);
0094 % set(H.trigger_axes, 'FontUnit', 'normalized');
0095 
0096 
0097 % Set Grid on
0098 set(H.trigger_axes, 'XGrid', 'on');
0099 set(H.trigger_axes, 'YGrid', 'on');
0100 
0101 
0102 % Yrange
0103 range = ylim(H.trigger_axes);
0104 set(H.ylimit_trigger_low_edit, 'String', num2str(range(1)));
0105 set(H.ylimit_trigger_high_edit, 'String', num2str(range(2)));
0106 
0107 xlim(H.trigger_axes, [window_from, window_to]);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005