Commit dc388445 authored by James Desjardins's avatar James Desjardins
Browse files

Remove 'srate', 'chans' and 'event_type' fields from vised_config so that they...

Remove 'srate', 'chans' and 'event_type' fields from vised_config so that they are not remembered in the workspace.
parent 6bf14d2e
......@@ -1205,6 +1205,11 @@ else
% ---------
axes(g.ax1)
hold on
g.spacing = oldspacing;
set(g.ax1, 'Xlim',[1 g.winlength*multiplier+1],...
'XTick',[1:multiplier*DEFAULT_GRID_SPACING:g.winlength*multiplier+1]);
set(g.ax1, 'XTickLabel', num2str((g.time:DEFAULT_GRID_SPACING:g.time+g.winlength)'))
%% HANDLE MARKING ...
......@@ -1250,10 +1255,9 @@ else
% get the color of the current mark tick.
plot_colour = g.chan_marks_struct(mark_inds(fi)).tag_color;
if isempty(findobj('tag',['tagtext_' g.chan_marks_struct(fi).label]));
if isempty(findobj(gcf,'tag',['tagtext_' g.chan_marks_struct(fi).label]));
text(figdim(1)-(.01*figdim(2)-figdim(1))*fi,ylims(2)-0.005,['> ',g.chan_marks_struct(mark_inds(fi)).label], ...
'color',plot_colour, ...
'fontweight','bold', ...
'interpreter','none', ...
'tag',['tagtext_' g.chan_marks_struct(fi).label], ...
'rotation',90);
......@@ -1349,7 +1353,7 @@ else
alpha(sh,g.marks_col_alpha);
% add the label of the current time mark (if object empty).
if isempty(findobj('tag',['text_' g.time_marks_struct(tmi).label]));
if isempty(findobj(gcf,'tag',['text_' g.time_marks_struct(tmi).label]));
text(figdim(2), ...
ylims(1)+(inter_time_mark_offset*.5)+inter_time_mark_offset*tmi+(time_marks_offset(i))-(inter_time_mark_offset*length(g.time_marks_struct)), ...
['> ',g.time_marks_struct(tmi).label], ...
......@@ -1382,10 +1386,10 @@ else
end
end
end
g.spacing = oldspacing;
set(g.ax1, 'Xlim',[1 g.winlength*multiplier+1],...
'XTick',[1:multiplier*DEFAULT_GRID_SPACING:g.winlength*multiplier+1]);
set(g.ax1, 'XTickLabel', num2str((g.time:DEFAULT_GRID_SPACING:g.time+g.winlength)'))
% g.spacing = oldspacing;
% set(g.ax1, 'Xlim',[1 g.winlength*multiplier+1],...
% 'XTick',[1:multiplier*DEFAULT_GRID_SPACING:g.winlength*multiplier+1]);
% set(g.ax1, 'XTickLabel', num2str((g.time:DEFAULT_GRID_SPACING:g.time+g.winlength)'))
% ordinates: even if all elec are plotted, some may be hidden
set(g.ax1, 'ylim',[g.elecoffset*g.spacing (g.elecoffset+g.dispchans+1)*g.spacing] );
......@@ -1676,7 +1680,12 @@ else
g.winlength = eval(result{1});
set(gcf, 'UserData', g);
ve_eegplot('drawp',0);
% delete mark labels
text_h=findobj('-regexp','tag','text_*');delete(text_h);
marker_h=findobj('-regexp','tag','marker_*');delete(marker_h);
ve_eegplot('drawp',0);
return;
case 'winelec' % change channel window size
......@@ -1829,12 +1838,12 @@ else
obj = findobj(fig, 'type', 'uimenu');delete(obj);
case 'zoom' % if zoom
g = get(gcf,'UserData');
fig = varargin{1};
tmpxlim = get(g.ax1, 'xlim');
tmpylim = get(g.ax1, 'ylim');
tmpxlim2 = get(g.ax0, 'xlim');
set(g.ax0, 'xlim', get(g.ax1, 'xlim'));
g = get(fig,'UserData');
% deal with abscissa
% ------------------
......
......@@ -20,7 +20,7 @@ vised_config.marks_col_int=[];
vised_config.marks_col_alpha=[];
%eegplot options
vised_config.srate=[];%store sample rate value or name of sample rate var... if empty EEG.srate... implemented
%vised_config.srate=[];%store sample rate value or name of sample rate var... if empty EEG.srate... implemented
vised_config.spacing=[];
vised_config.eloc_file='';%store name of channel location structure or location fname... if empty EEG.chanlocs
vised_config.limits=[];
......
......@@ -113,13 +113,6 @@ properties = [ ...
'Description', ['Alpha is a value between 0 and 1 where 0 = transparent and 1 = opaque {default .7}.']) ...
...
...
PropertyGridField('srate', vised_config.srate, ...
'Type', PropertyType('denserealdouble','matrix'), ...
'Category', 'eegplot options', ...
'DisplayName', 'sampling rate [srate]', ...
'Description', ['Sampling rate in Hz {default|0: 256 Hz}. ' ...
'Use in the calculation of', ...
'times labels on the x axis of the eegplot scroll window']) ...
PropertyGridField('spacing', vised_config.spacing, ...
'Type', PropertyType('denserealdouble','matrix'), ...
'Category', 'eegplot options', ...
......
......@@ -61,58 +61,101 @@ end
try
options = varargin;
for index = 1:length(options)
if iscell(options{index}) & ~iscell(options{index}{1}), options{index} = { options{index} }; end;
if iscell(options{index}) && ~iscell(options{index}{1})
options{index} = { options{index} };
end
end;
if ~isempty( varargin ),
g=struct(options{:});
else
g= [];
end;
if ~isempty( varargin ), g=struct(options{:});
else g= []; end;
catch
disp('ve_eegplot() error: calling convention {''key'', value, ... } error'); return;
end;
%INSERT g options into vised_config else defaults...
% data options...
try vised_config.pop_gui=g.pop_gui;
catch, if isempty(vised_config.pop_gui);vised_config.pop_gui='on';end
end;
try vised_config.data_type=g.data_type;
catch, if isempty(vised_config.data_type);vised_config.data_type='EEG';end
% 'data_type', if it is not in varargin, and empty in base vised_config make
% the default 'EEG'.
try
vised_config.data_type=g.data_type;
catch
if isempty(vised_config.data_type)
vised_config.data_type='EEG';
end
end
% Handle options that are not included in vised_config.
% These options are not stored in vised_config because they should not be
% remembered in the default workspace. If they are remembered in base
% workspace they can result in confusing or erroneous usage.
% 'chans' stores the channel/comp indices to plot.
% This variable is not stored in vised_config.
% 'chans' is initially determined fresh from the EEG structure on every run.
% 'chans', if it is not in varargin make the default equal to the indices
% of either either EEG or ICA arrays based on 'data_type'
chans = '';
try chans=g.chans;
catch,
if isempty(chans);
switch vised_config.data_type;
case 'EEG'
chans=vararg2str(1:EEG.nbchan);
case 'ICA'
chans=vararg2str(1:min(size(EEG.icaweights)));
end
try
chans=g.chans;
catch
switch vised_config.data_type;
case 'EEG'
chans=vararg2str(1:EEG.nbchan);
case 'ICA'
chans=vararg2str(1:min(size(EEG.icaweights)));
end
end
% check for numeric event.type entries.. if found change to strings.
j=0;
for i=1:length(EEG.event)
if isnumeric(EEG.event(i).type)
j=j+1;
if j==1;disp('at least one event.type is numberic... changing to string...');end;
if j==1
disp('at least one event.type is numeric... changing to string...');
end
EEG.event(i).type=num2str(EEG.event(i).type);
end
end
% 'event_type' stores the unique event labels to plot.
% This variable is not stored in vised_config.
% 'event_type' is initially determined fresh from the EEG structure on every run.
% 'event_type', if it is not in varargin make the default equal to the indices
% of either EEG or ICA arrays based on 'data_type'
event_type = {};
try event_type=g.event_type;
catch, if isempty(event_type);
if isempty(EEG.event);
event_type={};
else
event_type=unique({EEG.event.type});
end
try
event_type=g.event_type;
catch
if isempty(EEG.event);
event_type={};
else
event_type=unique({EEG.event.type});
end
end
% 'srate'
srate = [];
try
srate=g.srate;
catch
srate=EEG.srate;
end
% 'pop_gui', if it is not in varargin, and empty in base vised_config make
% the default 'on'.
try
vised_config.pop_gui=g.pop_gui;
catch
if isempty(vised_config.pop_gui);
vised_config.pop_gui='on';
end
end;
%INSERT g options into vised_config else defaults...
%vised_options...
try vised_config.winrej_marks_labels = g.winrej_marks_labels;
catch, if isempty(vised_config.winrej_marks_labels);vised_config.winrej_marks_labels='manual';end
......@@ -162,7 +205,11 @@ end
%eegplot_options...
try vised_config.srate=g.srate; catch,end
% 'srate' has been removed because it should always be obtained from
% EEG.srate (but can still be over written via varagr in for rare corner
% cases).
%try vised_config.srate=g.srate; catch,end
try vised_config.spacing = g.spacing; catch,end
try vised_config.eloc_file = g.eloc_file; catch,end
......@@ -413,12 +460,6 @@ if ~isempty(str2num(chans));
chans=str2num(chans);
end
%if ischar(vised_config.chans);
% chans=eval(vised_config.chans);
%else
% chans=vised_config.chans;
%end
% HANDLE data_type
switch vised_config.data_type
case 'EEG'
......@@ -567,6 +608,11 @@ end
%% COLLECT EEGPLOT_OPTIONS AND EXECUTE CALL TO EEGPLOT...
vararg_cell=object2varargin(vised_config,vised_option_names);
% prepend srate.. it always needs to be included...
vararg_cell={'srate',srate,vararg_cell{:}};
% rename 'tmp_events' to 'events' if occurs.
for i=1:length(vararg_cell);
if ischar(vararg_cell{i}) && strcmp(vararg_cell{i},'tmp_events');
vararg_cell{i}='events';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment