0001 function [p] = eeg_toolbox_defaults(command,p);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 eegversion = '$Revision: 1.1 $';
0048 fprintf('\nEEG_TOOLBOX_DEFAULTS [v %s]\n',eegversion(11:15));
0049
0050 if version('-release') < 10,
0051 msg = printf('matlab release < version 10, eeg_toolbox GUIs may fail.\n');
0052 warning(msg);
0053 end
0054
0055 if ~exist('command','var'), command = 'create'; end
0056
0057
0058 eegPath = eeg_toolbox_path;
0059
0060
0061
0062 mriPath = fileparts(which('avw_view'));
0063 if isempty(mriPath),
0064 msg = sprintf('Cannot find mri_toolbox on the matlab path.\nPlease install and use the addpath command.\n\n');
0065 warning(msg);
0066 mriPath = eegPath;
0067 else
0068 mriPath = strcat(mriPath,filesep);
0069 end
0070
0071
0072 if ispref('eeg_toolbox'),
0073 rmpref('eeg_toolbox');
0074 end
0075
0076
0077 switch command
0078 case 'create',
0079
0080 fprintf('...creating eeg_toolbox defaults\n\n');
0081
0082 [p] = [];
0083
0084
0085 p.file = strcat(eegPath,'eeg_example_data',filesep,'eeg_toolbox_defaults.mat');
0086
0087
0088 p.elec.path = strcat(eegPath,'eeg_example_data',filesep);
0089 p.elec.file = 'elec_124_cart.txt';
0090 p.elec.n = 129;
0091 p.elec.type = 'Cartesian';
0092 p.elec.shape = 'sphere';
0093 p.elec.data = [];
0094 p.elec.plot = 0;
0095 p.elec.plotSurf = 1;
0096
0097
0098 p.mesh.path = strcat(eegPath,'eeg_example_data',filesep);
0099 p.mesh.file = 'BrainStorm_subjecttess.mat';
0100 p.mesh.type = 'BrainStorm';
0101 p.mesh.data = [];
0102 p.mesh.plot.open = 0;
0103 p.mesh.plot.overlay = 0;
0104 p.mesh.plotSurf = 0;
0105 p.mesh.reload = 1;
0106 p.mesh.samplePoint = [];
0107 p.mesh.sampleTime = [];
0108 p.mesh.sampleMsec = [];
0109 p.mesh.sampleHz = [];
0110
0111
0112 p.volt.path = strcat(eegPath,'eeg_example_data',filesep);
0113 p.volt.file = 'eeg_124ch.dat';
0114 p.volt.type = 'ascii';
0115
0116 p.volt.data = [];
0117 p.volt.var = [];
0118 p.volt.timeArray = [];
0119 p.volt.points = [];
0120 p.volt.sampleHz = 400;
0121 p.volt.sampleMsec = 2.5;
0122 p.volt.sampleTime = 400;
0123 p.volt.samplePoint = 250;
0124 p.volt.channels = [];
0125 p.volt.epochStart = -200;
0126 p.volt.epochEnd = 1500;
0127 p.volt.sweeps = [];
0128 p.volt.peaks = [];
0129 p.volt.interpZero = 1;
0130
0131
0132 p.cnt.path = strcat(eegPath,'eeg_example_data',filesep);
0133 p.cnt.file = 'scan41_short.cnt';
0134 p.cnt.type = 'scan4x_cnt';
0135
0136 p.eeg.path = strcat(eegPath,'eeg_example_data',filesep);
0137 p.eeg.file = 'scan41_short.eeg';
0138 p.eeg.type = 'scan4x_eeg';
0139
0140
0141
0142
0143 p.erf.path = strcat(eegPath,'eeg_example_data',filesep);
0144 p.erf.file = 'eeg_124ch.dat';
0145 p.erf.type = 'ascii';
0146
0147 p.erf.data = [];
0148 p.erf.var = [];
0149 p.erf.timeArray = [];
0150 p.erf.points = [];
0151 p.erf.sampleHz = 400;
0152 p.erf.sampleMsec = 2.5;
0153 p.erf.sampleTime = 400;
0154 p.erf.samplePoint = 250;
0155 p.erf.channels = [];
0156 p.erf.epochStart = -200;
0157 p.erf.epochEnd = 1500;
0158 p.erf.sweeps = [];
0159 p.erf.peaks = [];
0160 p.erf.interpZero = 0;
0161
0162
0163
0164
0165 p.rangeMethod = 'minmaxabs' ;
0166 p.minimumIntensity = -10 ;
0167 p.maximumIntensity = 10 ;
0168 p.interpMethod = 'cubic' ;
0169
0170 p.timeMethod = 1 ;
0171 p.endTime = 2 ;
0172
0173 p.contour.stepMethod = 0;
0174 p.contour.Nsteps = 10;
0175 p.contour.stepSize = 1;
0176 p.contour.raw2D = 0;
0177 p.contour.plot2D = 0;
0178 p.contour.plot3D = 0;
0179
0180
0181
0182 p.grid.method = 1 ;
0183 p.grid.size = 100 ;
0184 p.grid.sizeMin = 10 ;
0185 p.grid.sizeMax = 210 ;
0186 p.grid.res = 0.1 ;
0187 p.grid.resMin = 0.01 ;
0188 p.grid.resMax = 2.01 ;
0189
0190
0191 p.clickTimePoint = 0;
0192 p.saveGraphics = 'No Save Plots';
0193 p.topoView = '2D';
0194 p = eeg_colormap(p);
0195 p.hold = 0;
0196
0197 case 'read'
0198
0199
0200 [path,name,ext] = fileparts(strcat(eegPath,'eeg_toolbox_defaults.mat'));
0201 p.file = fullfile(path,[name ext]);
0202 file = exist(p.file);
0203 if file == 2,
0204 fprintf('...reading eeg_toolbox defaults from:\n%s\n\n',p.file);
0205 load(p.file);
0206 else
0207 fprintf('...cannot locate eeg_toolbox defaults - recreating defaults.\n\n');
0208 [p] = eeg_toolbox_defaults;
0209 end
0210
0211
0212
0213
0214 voltPathExist = exist(p.volt.path);
0215 if ~voltPathExist,
0216 fprintf('...voltage path does not exist - reinitializing defaults.\n');
0217 [p] = eeg_toolbox_defaults('create');
0218 eeg_toolbox_defaults('write',p);
0219 end
0220
0221 case {'write','save'}
0222
0223 if ~exist('p','var'),
0224 msg = sprintf('p argument is essential: eeg_toolbox_defaults(''write'',p)');
0225 error(msg);
0226 end
0227
0228 [path,name,ext] = fileparts(strcat(eegPath,'eeg_toolbox_defaults.mat'));
0229 p.file = fullfile(path,[name ext]);
0230
0231 save(p.file,'p');
0232
0233 fprintf('...saved eeg_toolbox defaults to:\n%s\n\n',p.file);
0234
0235 case {'write_other','saveas'}
0236
0237 if ~exist('p','var'),
0238 msg = sprintf('p argument is essential: eeg_toolbox_defaults(''write_other'',p)');
0239 error(msg);
0240 end
0241
0242 [path,name,ext] = fileparts(strcat(p.volt.path, filesep, p.volt.file));
0243 ext = '.mat';
0244 p.file = fullfile(path,[name ext]);
0245
0246
0247 [newfile,newpath] = uiputfile(p.file,'Save EEG_TOOLBOX Parameters to File:');
0248 if (newfile == 0) & (newpath == 0),
0249 fprintf('...aborting save\n\n');
0250 else
0251 [path,name,ext] = fileparts(strcat(newpath, filesep, newfile));
0252 ext = '.mat';
0253 p.file = fullfile(path,[name ext]);
0254 save(p.file,'p');
0255 fprintf('...saved eeg_toolbox parameters to:\n%s\n\n',p.file);
0256 recentfiles = eeg_toolbox_recent(p.file);
0257 end
0258
0259 otherwise
0260 error('...invalid command\n\n');
0261 end
0262
0263 return