annotate toolboxes/MIRtoolbox1.3.2/somtoolbox/preprocess.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function preprocess(sData,arg2)
wolffd@0 2
wolffd@0 3 %PREPROCESS A GUI for data preprocessing.
wolffd@0 4 %
wolffd@0 5 % preprocess(sData)
wolffd@0 6 %
wolffd@0 7 % preprocess(sData)
wolffd@0 8 %
wolffd@0 9 % Launches a preprocessing GUI. The optional input argument can be
wolffd@0 10 % either a data struct or a struct array of such. However, primarily
wolffd@0 11 % the processed data sets are loaded to the application using the
wolffd@0 12 % tools in the GUI. Also, the only way to get the preprocessed data
wolffd@0 13 % sets back into the workspace is to use the tools in the GUI (press
wolffd@0 14 % the button DATA SET MANAGEMENT).
wolffd@0 15 %
wolffd@0 16 % For a more throughout description, see online documentation.
wolffd@0 17 % See also SOM_GUI.
wolffd@0 18
wolffd@0 19 %%%%%%%%%%%% DETAILED DESCRIPTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 20 %
wolffd@0 21 % IN FILES: preprocess.html,preproc.jpg,sDman.jpg,clip.jpg,delay.jpg,window.jpg,selVect.jpg
wolffd@0 22
wolffd@0 23 % Contributed to SOM Toolbox vs2, February 2nd, 2000 by Juha Parhankangas
wolffd@0 24 % Copyright (c) by Juha Parhankangas and the SOM Toolbox team
wolffd@0 25
wolffd@0 26 % http://www.cis.hut.fi/projects/somtoolbox/
wolffd@0 27
wolffd@0 28 % Juha Parhankangas 050100
wolffd@0 29
wolffd@0 30 global no_of_sc % every Nth component in 'relative values' is drawn stronger.
wolffd@0 31 no_of_sc=5;
wolffd@0 32
wolffd@0 33 if nargin < 1 | nargin > 2
wolffd@0 34 error('Invalid number of input arguments');
wolffd@0 35 return;
wolffd@0 36 end
wolffd@0 37
wolffd@0 38 if nargin == 1, arg2=[]; end
wolffd@0 39
wolffd@0 40 if ~isstr(sData) %%% Preprocess is started...
wolffd@0 41 data.LOG{1}='% Starting the ''Preprocess'' -window...';
wolffd@0 42 data.LOG{2}=cat(2,'preprocess(',...
wolffd@0 43 sprintf('%s);',inputname(1)));
wolffd@0 44
wolffd@0 45 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 46 if ~isempty(pre_h)
wolffd@0 47 figure(pre_h);
wolffd@0 48 msgbox('''Preprocess''-figure already exists.');
wolffd@0 49 return;
wolffd@0 50 end
wolffd@0 51
wolffd@0 52 h0 = figure('Color',[0.8 0.8 0.8], ...
wolffd@0 53 'PaperPosition',[18 180 576 432], ...
wolffd@0 54 'PaperUnits','points', ...
wolffd@0 55 'Position',[595 216 600 775], ...
wolffd@0 56 'Tag','Preprocess');
wolffd@0 57
wolffd@0 58 h1 = uicontrol('Parent',h0, ...
wolffd@0 59 'Units','normalized', ...
wolffd@0 60 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 61 'FontWeight','demi', ...
wolffd@0 62 'HorizontalAlignment','left', ...
wolffd@0 63 'ListboxTop',0, ...
wolffd@0 64 'Position',[0.015 0.06064516129032258 0.9550000000000001 0.1458064516129032], ...
wolffd@0 65 'Style','text', ...
wolffd@0 66 'Tag','StaticText1');
wolffd@0 67
wolffd@0 68 data.results_h = h1;
wolffd@0 69
wolffd@0 70 h1 = uicontrol('Parent',h0, ...
wolffd@0 71 'Units','normalized', ...
wolffd@0 72 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 73 'Callback','preprocess close', ...
wolffd@0 74 'FontWeight','demi', ...
wolffd@0 75 'ListboxTop',0, ...
wolffd@0 76 'Position',[0.8067 0.0142 0.1667 0.0348],...
wolffd@0 77 'String','CLOSE', ...
wolffd@0 78 'Tag','Pushbutton1');
wolffd@0 79
wolffd@0 80 h1 = uicontrol('Parent',h0, ...
wolffd@0 81 'Units','normalized', ...
wolffd@0 82 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 83 'FontWeight','demi', ...
wolffd@0 84 'HorizontalAlignment','left', ...
wolffd@0 85 'ListboxTop',0, ...
wolffd@0 86 'Position',[0.01833333333333333 0.2141935483870968 0.07000000000000001 0.01806451612903226], ...
wolffd@0 87 'String','LOG', ...
wolffd@0 88 'Style','text', ...
wolffd@0 89 'Tag','StaticText2');
wolffd@0 90
wolffd@0 91 h1 = uicontrol('Parent',h0, ...
wolffd@0 92 'Units','normalized', ...
wolffd@0 93 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 94 'Callback','preprocess sel_comp',...
wolffd@0 95 'FontWeight','demi', ...
wolffd@0 96 'ListboxTop',0, ...
wolffd@0 97 'Position',[0.7983333333333333 0.2090322580645161 0.1666666666666667 0.03483870967741935], ...
wolffd@0 98 'String',' ', ...
wolffd@0 99 'Style','popupmenu', ...
wolffd@0 100 'Tag','sel_comp_h', ...
wolffd@0 101 'Value',1);
wolffd@0 102
wolffd@0 103 data.sel_comp_h=h1;
wolffd@0 104
wolffd@0 105 h1 = uicontrol('Parent',h0, ...
wolffd@0 106 'Units','normalized', ...
wolffd@0 107 'BackgroundColor',[1 1 1], ...
wolffd@0 108 'ListboxTop',0, ...
wolffd@0 109 'Position',[0.0183 0.2568 0.2133 0.1290], ...
wolffd@0 110 'Style','text', ...
wolffd@0 111 'Tag','StaticText3');
wolffd@0 112
wolffd@0 113 data.sel_cdata_h=h1;
wolffd@0 114
wolffd@0 115 h1 = axes('Parent',h0, ...
wolffd@0 116 'CameraUpVector',[0 1 0], ...
wolffd@0 117 'CameraUpVectorMode','manual', ...
wolffd@0 118 'Color',[1 1 1], ...
wolffd@0 119 'Position',[0.2583 0.2568 0.2133 0.1290], ...
wolffd@0 120 'Tag','Axes1', ...
wolffd@0 121 'XColor',[0 0 0], ...
wolffd@0 122 'XTickLabel',['0 ';'0.5';'1 '], ...
wolffd@0 123 'XTickLabelMode','manual', ...
wolffd@0 124 'XTickMode','manual', ...
wolffd@0 125 'YColor',[0 0 0], ...
wolffd@0 126 'YTickMode','manual', ...
wolffd@0 127 'ZColor',[0 0 0]);
wolffd@0 128
wolffd@0 129 data.sel_chist_h=h1;
wolffd@0 130
wolffd@0 131 h2 = text('Parent',h1, ...
wolffd@0 132 'Color',[0 0 0], ...
wolffd@0 133 'HandleVisibility','off', ...
wolffd@0 134 'HorizontalAlignment','center', ...
wolffd@0 135 'Position',[0.4960629921259843 -0.08080808080808044 9.160254037844386], ...
wolffd@0 136 'Tag','Axes1Text4', ...
wolffd@0 137 'VerticalAlignment','cap');
wolffd@0 138 set(get(h2,'Parent'),'XLabel',h2);
wolffd@0 139 h2 = text('Parent',h1, ...
wolffd@0 140 'Color',[0 0 0], ...
wolffd@0 141 'HandleVisibility','off', ...
wolffd@0 142 'HorizontalAlignment','center', ...
wolffd@0 143 'Position',[-0.0551181102362206 0.4848484848484853 9.160254037844386], ...
wolffd@0 144 'Rotation',90, ...
wolffd@0 145 'Tag','Axes1Text3', ...
wolffd@0 146 'VerticalAlignment','baseline');
wolffd@0 147 set(get(h2,'Parent'),'YLabel',h2);
wolffd@0 148 h2 = text('Parent',h1, ...
wolffd@0 149 'Color',[0 0 0], ...
wolffd@0 150 'HandleVisibility','off', ...
wolffd@0 151 'HorizontalAlignment','right', ...
wolffd@0 152 'Position',[-1.2283 5.7980 9.1603], ...
wolffd@0 153 'Tag','Axes1Text2', ...
wolffd@0 154 'Visible','off');
wolffd@0 155 set(get(h2,'Parent'),'ZLabel',h2);
wolffd@0 156 h2 = text('Parent',h1, ...
wolffd@0 157 'Color',[0 0 0], ...
wolffd@0 158 'HandleVisibility','off', ...
wolffd@0 159 'HorizontalAlignment','center', ...
wolffd@0 160 'Position',[0.4960629921259843 1.070707070707071 9.160254037844386], ...
wolffd@0 161 'Tag','Axes1Text1', ...
wolffd@0 162 'VerticalAlignment','bottom');
wolffd@0 163 set(get(h2,'Parent'),'Title',h2);
wolffd@0 164
wolffd@0 165 h1 = axes('Parent',h0, ...
wolffd@0 166 'CameraUpVector',[0 1 0], ...
wolffd@0 167 'CameraUpVectorMode','manual', ...
wolffd@0 168 'Color',[0.7529 0.7529 0.7529], ...
wolffd@0 169 'Position',[0.4950000000000001 0.2567741935483871 0.4766666666666667 0.1290322580645161], ...
wolffd@0 170 'Tag','Axes2', ...
wolffd@0 171 'XColor',[0 0 0], ...
wolffd@0 172 'XTickMode','manual', ...
wolffd@0 173 'YColor',[0 0 0], ...
wolffd@0 174 'YTick',[0 0.5 1], ...
wolffd@0 175 'YTickMode','manual', ...
wolffd@0 176 'ZColor',[0 0 0]);
wolffd@0 177
wolffd@0 178 data.vector_h=h1;
wolffd@0 179
wolffd@0 180 h2 = text('Parent',h1, ...
wolffd@0 181 'Color',[0 0 0], ...
wolffd@0 182 'HandleVisibility','off', ...
wolffd@0 183 'HorizontalAlignment','center', ...
wolffd@0 184 'Position',[0.4982456140350879 -0.08080808080808044 9.160254037844386], ...
wolffd@0 185 'Tag','Axes2Text4', ...
wolffd@0 186 'VerticalAlignment','cap');
wolffd@0 187 set(get(h2,'Parent'),'XLabel',h2);
wolffd@0 188 h2 = text('Parent',h1, ...
wolffd@0 189 'Color',[0 0 0], ...
wolffd@0 190 'HandleVisibility','off', ...
wolffd@0 191 'HorizontalAlignment','center', ...
wolffd@0 192 'Position',[-0.1018 0.4848 9.1603], ...
wolffd@0 193 'Rotation',90, ...
wolffd@0 194 'Tag','Axes2Text3', ...
wolffd@0 195 'VerticalAlignment','baseline');
wolffd@0 196 set(get(h2,'Parent'),'YLabel',h2);
wolffd@0 197 h2 = text('Parent',h1, ...
wolffd@0 198 'Color',[0 0 0], ...
wolffd@0 199 'HandleVisibility','off', ...
wolffd@0 200 'HorizontalAlignment','right', ...
wolffd@0 201 'Position',[-1.045614035087719 5.797979797979799 9.160254037844386], ...
wolffd@0 202 'Tag','Axes2Text2', ...
wolffd@0 203 'Visible','off');
wolffd@0 204 set(get(h2,'Parent'),'ZLabel',h2);
wolffd@0 205 h2 = text('Parent',h1, ...
wolffd@0 206 'Color',[0 0 0], ...
wolffd@0 207 'HandleVisibility','off', ...
wolffd@0 208 'HorizontalAlignment','center', ...
wolffd@0 209 'Position',[0.4982456140350879 1.070707070707071 9.160254037844386], ...
wolffd@0 210 'Tag','Axes2Text1', ...
wolffd@0 211 'VerticalAlignment','bottom');
wolffd@0 212 set(get(h2,'Parent'),'Title',h2);
wolffd@0 213
wolffd@0 214 h1 = uicontrol('Parent',h0, ...
wolffd@0 215 'Units','normalized', ...
wolffd@0 216 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 217 'FontWeight','demi', ...
wolffd@0 218 'HorizontalAlignment','left', ...
wolffd@0 219 'ListboxTop',0, ...
wolffd@0 220 'Position',[0.01833333333333333 0.3922580645161291 0.17 0.01806451612903226], ...
wolffd@0 221 'String','STATISTICS', ...
wolffd@0 222 'Style','text', ...
wolffd@0 223 'Tag','StaticText4');
wolffd@0 224
wolffd@0 225 h1 = uicontrol('Parent',h0, ...
wolffd@0 226 'Units','normalized', ...
wolffd@0 227 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 228 'FontWeight','demi', ...
wolffd@0 229 'HorizontalAlignment','left', ...
wolffd@0 230 'ListboxTop',0, ...
wolffd@0 231 'Position',[0.2583333333333334 0.3922580645161291 0.1633333333333333 0.01806451612903226], ...
wolffd@0 232 'String','HISTOGRAM', ...
wolffd@0 233 'Style','text', ...
wolffd@0 234 'Tag','StaticText5');
wolffd@0 235
wolffd@0 236 h1 = uicontrol('Parent',h0, ...
wolffd@0 237 'Units','normalized', ...
wolffd@0 238 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 239 'FontWeight','demi',...
wolffd@0 240 'FontSize',6,...
wolffd@0 241 'HorizontalAlignment','left',...
wolffd@0 242 'String',{'LEFT: NEW SELECTION';'RIGHT: ADD TO SELECTION'}, ...
wolffd@0 243 'ListboxTop',0, ...
wolffd@0 244 'Position',[0.5016666666666667 0.38 0.235 0.03741935483870968], ...
wolffd@0 245 'Style','text', ...
wolffd@0 246 'Tag','StaticText6', ...
wolffd@0 247 'UserData','[ ]');
wolffd@0 248
wolffd@0 249 h1 = uicontrol('Parent',h0, ...
wolffd@0 250 'Units','normalized', ...
wolffd@0 251 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 252 'Callback','preprocess selall', ...
wolffd@0 253 'FontWeight','demi', ...
wolffd@0 254 'ListboxTop',0, ...
wolffd@0 255 'Position',[0.8066666666666668 0.3922580645161291 0.1666666666666667 0.03483870967741935], ...
wolffd@0 256 'String','SELECT ALL', ...
wolffd@0 257 'Tag','Pushbutton2', ...
wolffd@0 258 'UserData','[ ]');
wolffd@0 259
wolffd@0 260 h1 = uicontrol('Parent',h0, ...
wolffd@0 261 'Units','normalized', ...
wolffd@0 262 'BackgroundColor',[0.7529 0.7529 0.7529], ...
wolffd@0 263 'Position',[0.01833333333333333 0.4503225806451613 0.23 0.3225806451612903], ...
wolffd@0 264 'String',' ', ...
wolffd@0 265 'Style','listbox', ...
wolffd@0 266 'Tag','Listbox1', ...
wolffd@0 267 'Value',1);
wolffd@0 268
wolffd@0 269 data.comp_names_h=h1;
wolffd@0 270
wolffd@0 271 h1 = uicontrol('Parent',h0, ...
wolffd@0 272 'Units','normalized', ...
wolffd@0 273 'BackgroundColor',[1 1 1], ...
wolffd@0 274 'Position',[0.4950000000000001 0.4503225806451613 0.2333333333333333 0.3225806451612903], ...
wolffd@0 275 'String',' ', ...
wolffd@0 276 'Style','listbox', ...
wolffd@0 277 'Tag','Listbox2', ...
wolffd@0 278 'Value',1);
wolffd@0 279
wolffd@0 280 data.vect_mean_h = h1;
wolffd@0 281
wolffd@0 282 h1 = axes('Parent',h0, ...
wolffd@0 283 'CameraUpVector',[0 1 0], ...
wolffd@0 284 'CameraUpVectorMode','manual', ...
wolffd@0 285 'Color',[1 1 1], ...
wolffd@0 286 'Position',[0.7383333333333334 0.4503225806451613 0.2333333333333333 0.3225806451612903], ...
wolffd@0 287 'Tag','Axes3', ...
wolffd@0 288 'XColor',[0 0 0], ...
wolffd@0 289 'XTickMode','manual', ...
wolffd@0 290 'YColor',[0 0 0], ...
wolffd@0 291 'YTickMode','manual', ...
wolffd@0 292 'ZColor',[0 0 0]);
wolffd@0 293
wolffd@0 294 data.sel_cplot_h = h1;
wolffd@0 295
wolffd@0 296 h2 = text('Parent',h1, ...
wolffd@0 297 'Color',[0 0 0], ...
wolffd@0 298 'HandleVisibility','off', ...
wolffd@0 299 'HorizontalAlignment','center', ...
wolffd@0 300 'Position',[0.4964028776978418 -0.03212851405622486 9.160254037844386], ...
wolffd@0 301 'Tag','Axes3Text4', ...
wolffd@0 302 'VerticalAlignment','cap');
wolffd@0 303 set(get(h2,'Parent'),'XLabel',h2);
wolffd@0 304 h2 = text('Parent',h1, ...
wolffd@0 305 'Color',[0 0 0], ...
wolffd@0 306 'HandleVisibility','off', ...
wolffd@0 307 'HorizontalAlignment','center', ...
wolffd@0 308 'Position',[-0.05035971223021596 0.493975903614458 9.160254037844386], ...
wolffd@0 309 'Rotation',90, ...
wolffd@0 310 'Tag','Axes3Text3', ...
wolffd@0 311 'VerticalAlignment','baseline');
wolffd@0 312 set(get(h2,'Parent'),'YLabel',h2);
wolffd@0 313 h2 = text('Parent',h1, ...
wolffd@0 314 'Color',[0 0 0], ...
wolffd@0 315 'HandleVisibility','off', ...
wolffd@0 316 'HorizontalAlignment','right', ...
wolffd@0 317 'Position',[-3.1942 1.7028 9.1603], ...
wolffd@0 318 'Tag','Axes3Text2', ...
wolffd@0 319 'Visible','off');
wolffd@0 320 set(get(h2,'Parent'),'ZLabel',h2);
wolffd@0 321 h2 = text('Parent',h1, ...
wolffd@0 322 'Color',[0 0 0], ...
wolffd@0 323 'HandleVisibility','off', ...
wolffd@0 324 'HorizontalAlignment','center', ...
wolffd@0 325 'Position',[0.4964028776978418 1.028112449799197 9.160254037844386], ...
wolffd@0 326 'Tag','Axes3Text1', ...
wolffd@0 327 'VerticalAlignment','bottom');
wolffd@0 328 set(get(h2,'Parent'),'Title',h2);
wolffd@0 329
wolffd@0 330 h1 = uicontrol('Parent',h0, ...
wolffd@0 331 'Units','normalized', ...
wolffd@0 332 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 333 'Callback','preprocess plxy', ...
wolffd@0 334 'FontWeight','demi', ...
wolffd@0 335 'ListboxTop',0, ...
wolffd@0 336 'Position',[0.265 0.4683870967741936 0.125 0.03483870967741935], ...
wolffd@0 337 'String','XY-PLOT', ...
wolffd@0 338 'Tag','Pushbutton3');
wolffd@0 339
wolffd@0 340 h1 = uicontrol('Parent',h0, ...
wolffd@0 341 'Units','normalized', ...
wolffd@0 342 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 343 'Callback','preprocess hist', ...
wolffd@0 344 'FontWeight','demi', ...
wolffd@0 345 'ListboxTop',0, ...
wolffd@0 346 'Position',[0.265 0.5303225806451613 0.125 0.03483870967741935], ...
wolffd@0 347 'String','HISTOGRAM', ...
wolffd@0 348 'Tag','Pushbutton4');
wolffd@0 349
wolffd@0 350 h1 = uicontrol('Parent',h0, ...
wolffd@0 351 'Units','normalized', ...
wolffd@0 352 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 353 'Callback','preprocess bplo', ...
wolffd@0 354 'FontWeight','demi', ...
wolffd@0 355 'ListboxTop',0, ...
wolffd@0 356 'Position',[0.265 0.5922580645161291 0.125 0.03483870967741935], ...
wolffd@0 357 'String','BOX PLOT', ...
wolffd@0 358 'Tag','Pushbutton5');
wolffd@0 359
wolffd@0 360 h1 = uicontrol('Parent',h0, ...
wolffd@0 361 'Units','normalized', ...
wolffd@0 362 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 363 'Callback','preprocess plot', ...
wolffd@0 364 'FontWeight','demi', ...
wolffd@0 365 'ListboxTop',0, ...
wolffd@0 366 'Position',[0.265 0.654195483870968 0.125 0.03483870967741935], ...
wolffd@0 367 'String','PLOT', ...
wolffd@0 368 'Tag','Pushbutton6');
wolffd@0 369
wolffd@0 370 h1 = uicontrol('Parent',h0, ...
wolffd@0 371 'Units','normalized', ...
wolffd@0 372 'BackgroundColor',[1 1 1], ...
wolffd@0 373 'ListboxTop',0, ...
wolffd@0 374 'Position',[0.4088888888888889 0.5333333333333333 0.06 0.03268817204301075], ...
wolffd@0 375 'String','30', ...
wolffd@0 376 'Style','edit', ...
wolffd@0 377 'Tag','EditText1');
wolffd@0 378
wolffd@0 379 data.no_of_bins_h = h1;
wolffd@0 380
wolffd@0 381
wolffd@0 382 h1 = uicontrol('Parent',h0, ...
wolffd@0 383 'Units','normalized', ...
wolffd@0 384 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 385 'FontWeight','demi', ...
wolffd@0 386 'HorizontalAlignment','left', ...
wolffd@0 387 'ListboxTop',0, ...
wolffd@0 388 'Position',[0.01833333333333333 0.775483870967742 0.2016666666666667 0.01806451612903226], ...
wolffd@0 389 'String','COMPONENT LIST', ...
wolffd@0 390 'Style','text', ...
wolffd@0 391 'Tag','StaticText7');
wolffd@0 392
wolffd@0 393 h1 = uicontrol('Parent',h0, ...
wolffd@0 394 'Units','normalized', ...
wolffd@0 395 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 396 'FontWeight','demi', ...
wolffd@0 397 'HorizontalAlignment','left', ...
wolffd@0 398 'ListboxTop',0, ...
wolffd@0 399 'Position',[0.4950000000000001 0.775483870967742 0.1966666666666667 0.01806451612903226], ...
wolffd@0 400 'String','AVERAGE', ...
wolffd@0 401 'Style','text', ...
wolffd@0 402 'Tag','StaticText8');
wolffd@0 403
wolffd@0 404 h1 = uicontrol('Parent',h0, ...
wolffd@0 405 'Units','normalized', ...
wolffd@0 406 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 407 'FontWeight','demi', ...
wolffd@0 408 'HorizontalAlignment','left', ...
wolffd@0 409 'ListboxTop',0, ...
wolffd@0 410 'Position',[0.7383333333333334 0.775483870967742 0.225 0.01806451612903226], ...
wolffd@0 411 'String','RELATIVE VALUES', ...
wolffd@0 412 'Style','text', ...
wolffd@0 413 'Tag','StaticText9');
wolffd@0 414
wolffd@0 415 h1 = uicontrol('Parent',h0, ...
wolffd@0 416 'Units','normalized', ...
wolffd@0 417 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 418 'FontSize',10, ...
wolffd@0 419 'FontWeight','demi', ...
wolffd@0 420 'HorizontalAlignment','left', ...
wolffd@0 421 'ListboxTop',0, ...
wolffd@0 422 'Position',[0.01833333333333333 0.8154838709677419 0.2033333333333333 0.0232258064516129], ...
wolffd@0 423 'String','COMPONENTS', ...
wolffd@0 424 'Style','text', ...
wolffd@0 425 'Tag','StaticText10');
wolffd@0 426
wolffd@0 427 h1 = uicontrol('Parent',h0, ...
wolffd@0 428 'Units','normalized', ...
wolffd@0 429 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 430 'FontSize',10, ...
wolffd@0 431 'FontWeight','demi', ...
wolffd@0 432 'HorizontalAlignment','left', ...
wolffd@0 433 'ListboxTop',0, ...
wolffd@0 434 'Position',[0.4950000000000001 0.8154838709677419 0.2 0.0232258064516129], ...
wolffd@0 435 'String','VECTORS', ...
wolffd@0 436 'Style','text', ...
wolffd@0 437 'Tag','StaticText11');
wolffd@0 438
wolffd@0 439 h1 = uicontrol('Parent',h0, ...
wolffd@0 440 'Units','normalized', ...
wolffd@0 441 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 442 'Callback','preprocess sD_management', ...
wolffd@0 443 'FontSize',5, ...
wolffd@0 444 'FontWeight','demi', ...
wolffd@0 445 'ListboxTop',0, ...
wolffd@0 446 'Position',[0.01833333333333333 0.8503225806451613 0.1666666666666667 0.03483870967741935], ...
wolffd@0 447 'String','DATA SET MANAGEMENT', ...
wolffd@0 448 'Tag','Pushbutton7');
wolffd@0 449
wolffd@0 450 h1 = uicontrol('Parent',h0, ...
wolffd@0 451 'Units','normalized', ...
wolffd@0 452 'Callback','preprocess sel_sD', ...
wolffd@0 453 'ListboxTop',0, ...
wolffd@0 454 'Position',[0.01833333333333333 0.8890322580645161 0.1666666666666667 0.03483870967741935], ...
wolffd@0 455 'String',' ', ...
wolffd@0 456 'Style','popupmenu', ...
wolffd@0 457 'Tag','PopupMenu2', ...
wolffd@0 458 'Value',1);
wolffd@0 459
wolffd@0 460 data.sD_set_h = h1;
wolffd@0 461
wolffd@0 462 h1 = uicontrol('Parent',h0, ...
wolffd@0 463 'Units','normalized', ...
wolffd@0 464 'BackgroundColor',[1 1 1], ...
wolffd@0 465 'ListboxTop',0, ...
wolffd@0 466 'Position',[0.2516666666666667 0.8503225806451613 0.7216666666666667 0.07354838709677419], ...
wolffd@0 467 'Style','text', ...
wolffd@0 468 'Tag','StaticText12');
wolffd@0 469
wolffd@0 470 data.sD_name_h = h1;
wolffd@0 471
wolffd@0 472 h1 = uicontrol('Parent',h0, ...
wolffd@0 473 'Units','normalized', ...
wolffd@0 474 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 475 'FontSize',10, ...
wolffd@0 476 'FontWeight','demi', ...
wolffd@0 477 'HorizontalAlignment','left', ...
wolffd@0 478 'ListboxTop',0, ...
wolffd@0 479 'Position',[0.01833333333333333 0.9341935483870968 0.1616666666666667 0.02064516129032258], ...
wolffd@0 480 'String','DATA SETS', ...
wolffd@0 481 'Style','text', ...
wolffd@0 482 'Tag','StaticText13');
wolffd@0 483
wolffd@0 484 h1 = uicontrol('Parent',h0, ...
wolffd@0 485 'Units','normalized', ...
wolffd@0 486 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 487 'FontSize',10, ...
wolffd@0 488 'FontWeight','demi', ...
wolffd@0 489 'HorizontalAlignment','left', ...
wolffd@0 490 'ListboxTop',0, ...
wolffd@0 491 'Position',[0.2516666666666667 0.9341935483870968 0.2833333333333333 0.02064516129032258], ...
wolffd@0 492 'String','SELECTED DATA SET', ...
wolffd@0 493 'Style','text', ...
wolffd@0 494 'Tag','StaticText14');
wolffd@0 495
wolffd@0 496 if ~isstruct(sData),
wolffd@0 497 sData=som_data_struct(sData);
wolffd@0 498 end
wolffd@0 499
wolffd@0 500 ui_h=uimenu('Label','&Normalization');
wolffd@0 501 uimenu(ui_h,'Label','Scale [0,1]','Callback','preprocess zscale');
wolffd@0 502 uimenu(ui_h,'Label','Scale var=1','Callback','preprocess vscale');
wolffd@0 503 uimenu(ui_h,'Label','HistD','Callback','preprocess histeq');
wolffd@0 504 uimenu(ui_h,'Label','HistC','Callback','preprocess histeq2');
wolffd@0 505 uimenu(ui_h,'Label','Log','Callback','preprocess log');
wolffd@0 506 uimenu(ui_h,'Label','Eval (1-comp)','Callback','preprocess eval1');
wolffd@0 507
wolffd@0 508 ui_h=uimenu('Label','&Components');
wolffd@0 509 uimenu(ui_h,'Label','Move component','Callback','preprocess move');
wolffd@0 510 uimenu(ui_h,'Label','Copy component','Callback','preprocess copy');
wolffd@0 511 uimenu(ui_h,'Label','Add: N binary types','Callback','preprocess oneo');
wolffd@0 512 uimenu(ui_h,'Label','Add: zeros','Callback','preprocess zero');
wolffd@0 513 uimenu(ui_h,'Label','Remove component','Callback','preprocess remove');
wolffd@0 514 uimenu(ui_h,'Label','Remove selected vectors',...
wolffd@0 515 'Callback','preprocess remove_vects');
wolffd@0 516 uimenu(ui_h,'Label','Select all components',...
wolffd@0 517 'Callback','preprocess sel_all_comps');
wolffd@0 518
wolffd@0 519 ui_h=uimenu('Label','&Misc');
wolffd@0 520 ui_h1=uimenu(ui_h,'Label','Calculate');
wolffd@0 521 ui_h2=uimenu(ui_h,'Label','Process');
wolffd@0 522
wolffd@0 523 uimenu(ui_h,'Label','Get LOG-file','Callback','preprocess LOG');
wolffd@0 524 uimenu(ui_h,'Label','Indices of the selected vectors',...
wolffd@0 525 'Callback','preprocess get_inds');
wolffd@0 526 uimenu(ui_h,'Label','Undo','Callback','preprocess undo');
wolffd@0 527 uimenu(ui_h1,'Label','Number of values','Callback','preprocess noof');
wolffd@0 528 uimenu(ui_h1,'Label','Number of selected vectors',...
wolffd@0 529 'Callback','preprocess no_of_sel');
wolffd@0 530 uimenu(ui_h1,'Label','Correlation','Callback','preprocess corr');
wolffd@0 531 uimenu(ui_h2,'Label','Unit length','Callback','preprocess unit');
wolffd@0 532 uimenu(ui_h2,'Label','Eval','Callback','preprocess eval2');
wolffd@0 533 uimenu(ui_h2,'Label','Clipping','Callback','preprocess clipping');
wolffd@0 534 uimenu(ui_h2,'Label','Delay','Callback','preprocess delay');
wolffd@0 535 uimenu(ui_h2,'Label','Windowed','Callback','preprocess window');
wolffd@0 536 uimenu(ui_h2,'Label','Select vectors','Callback','preprocess select');
wolffd@0 537
wolffd@0 538 len=getfield(size(sData(1).data),{1});
wolffd@0 539 data.selected_vects=find(ones(1,len));
wolffd@0 540 data.sD_set=sData;
wolffd@0 541 set(data.vector_h,'ButtonDownFcn','preprocess(''vector_bdf'',''down'')');
wolffd@0 542 set(gcf,'UserData',data);
wolffd@0 543 if ~set_sD_stats;
wolffd@0 544 return;
wolffd@0 545 end
wolffd@0 546 sel_sD;
wolffd@0 547 return; %%% Preprocess-window is ready.
wolffd@0 548
wolffd@0 549 else
wolffd@0 550 arg=sData;
wolffd@0 551 if strcmp(arg,'rename')
wolffd@0 552 rename(arg2);
wolffd@0 553 elseif strcmp(arg,'sel_sD')
wolffd@0 554 if isempty(arg2)
wolffd@0 555 sel_sD;
wolffd@0 556 else
wolffd@0 557 sel_sD(arg2);
wolffd@0 558 end
wolffd@0 559 elseif strcmp(arg,'zscale')
wolffd@0 560 if isempty(arg2)
wolffd@0 561 zero2one_scale;
wolffd@0 562 else
wolffd@0 563 zero2one_scale(arg2);
wolffd@0 564 end
wolffd@0 565 elseif strcmp(arg,'vscale');
wolffd@0 566 if isempty(arg2)
wolffd@0 567 var_scale;
wolffd@0 568 else
wolffd@0 569 var_scale(arg2);
wolffd@0 570 end
wolffd@0 571 elseif strcmp(arg,'histeq2')
wolffd@0 572 if isempty(arg2)
wolffd@0 573 hist_eq2;
wolffd@0 574 else
wolffd@0 575 hist_eq2(arg2);
wolffd@0 576 end
wolffd@0 577 elseif strcmp(arg,'log')
wolffd@0 578 if isempty(arg2)
wolffd@0 579 logarithm;
wolffd@0 580 else
wolffd@0 581 logarithm(arg2);
wolffd@0 582 end
wolffd@0 583 elseif strcmp(arg,'eval1')
wolffd@0 584 if isempty(arg2)
wolffd@0 585 eval1;
wolffd@0 586 else
wolffd@0 587 eval1(arg2);
wolffd@0 588 end
wolffd@0 589 elseif strcmp(arg,'eval2')
wolffd@0 590 if isempty(arg2)
wolffd@0 591 eval2;
wolffd@0 592 else
wolffd@0 593 eval2(arg2);
wolffd@0 594 end
wolffd@0 595 elseif strcmp(arg,'histeq');
wolffd@0 596 if isempty(arg2)
wolffd@0 597 hist_eq;
wolffd@0 598 else
wolffd@0 599 hist_eq(arg2);
wolffd@0 600 end
wolffd@0 601 elseif strcmp(arg,'selall')
wolffd@0 602 if isempty(arg2)
wolffd@0 603 select_all;
wolffd@0 604 else
wolffd@0 605 select_all(arg2);
wolffd@0 606 end
wolffd@0 607 elseif strcmp(arg,'sel_button');
wolffd@0 608 if isempty(arg2)
wolffd@0 609 sel_button;
wolffd@0 610 else
wolffd@0 611 sel_button(arg2);
wolffd@0 612 end
wolffd@0 613 elseif strcmp(arg,'clear_button')
wolffd@0 614 if isempty(arg2)
wolffd@0 615 clear_button;
wolffd@0 616 else
wolffd@0 617 clear_button(arg2)
wolffd@0 618 end
wolffd@0 619 elseif(strcmp(arg,'move'))
wolffd@0 620 if isempty(arg2)
wolffd@0 621 move_component;
wolffd@0 622 else
wolffd@0 623 move_component(arg2);
wolffd@0 624 end
wolffd@0 625 elseif(strcmp(arg,'copy'))
wolffd@0 626 if isempty(arg2)
wolffd@0 627 copy_component;
wolffd@0 628 else
wolffd@0 629 copy_component(arg2);
wolffd@0 630 end
wolffd@0 631 elseif strcmp(arg,'oneo')
wolffd@0 632 if isempty(arg2)
wolffd@0 633 one_of_n;
wolffd@0 634 else
wolffd@0 635 one_of_n(arg2);
wolffd@0 636 end
wolffd@0 637 elseif strcmp(arg,'zero')
wolffd@0 638 if isempty(arg2)
wolffd@0 639 add_zeros;
wolffd@0 640 else
wolffd@0 641 add_zeros(arg2);
wolffd@0 642 end
wolffd@0 643 elseif strcmp(arg,'remove')
wolffd@0 644 if isempty(arg2)
wolffd@0 645 remove_component;
wolffd@0 646 else
wolffd@0 647 remove_component(arg2);
wolffd@0 648 end
wolffd@0 649 elseif strcmp(arg,'remove_vects')
wolffd@0 650 if isempty(arg2)
wolffd@0 651 remove_vects;
wolffd@0 652 else
wolffd@0 653 remove_vects(arg2);
wolffd@0 654 end
wolffd@0 655 elseif strcmp(arg,'noof')
wolffd@0 656 if isempty(arg2)
wolffd@0 657 no_of_values;
wolffd@0 658 else
wolffd@0 659 no_of_values(arg2);
wolffd@0 660 end
wolffd@0 661 elseif strcmp(arg,'corr');
wolffd@0 662 if isempty(arg2)
wolffd@0 663 correlation;
wolffd@0 664 else
wolffd@0 665 correlation(arg2);
wolffd@0 666 end
wolffd@0 667 elseif strcmp(arg,'unit')
wolffd@0 668 if isempty(arg2)
wolffd@0 669 unit_length;
wolffd@0 670 else
wolffd@0 671 unit_length(arg2);
wolffd@0 672 end
wolffd@0 673 elseif strcmp(arg,'clip_data')
wolffd@0 674 clip_data(arg2);
wolffd@0 675 elseif strcmp(arg,'copy_delete')
wolffd@0 676 copy_delete(arg2);
wolffd@0 677 elseif strcmp(arg,'and_or_cb')
wolffd@0 678 and_or_cb(arg2);
wolffd@0 679 elseif strcmp(arg,'all_sel_cb')
wolffd@0 680 all_sel_cb(arg2);
wolffd@0 681 elseif strcmp(arg,'clip_exp_cb')
wolffd@0 682 clip_exp_cb(arg2);
wolffd@0 683 elseif strcmp(arg,'window_cb')
wolffd@0 684 window_cb(arg2);
wolffd@0 685 elseif strcmp(arg,'set_state_vals')
wolffd@0 686 set_state_vals(arg2);
wolffd@0 687 elseif strcmp(arg,'vector_bdf')
wolffd@0 688 vector_bdf(arg2);
wolffd@0 689 elseif strcmp(arg,'sD_management');
wolffd@0 690 if isempty(arg2)
wolffd@0 691 sD_management;
wolffd@0 692 else
wolffd@0 693 sD_management(arg2);
wolffd@0 694 end
wolffd@0 695 elseif strcmp(arg,'clipping')
wolffd@0 696 if isempty(arg2)
wolffd@0 697 clipping;
wolffd@0 698 else
wolffd@0 699 clipping(arg2);
wolffd@0 700 end
wolffd@0 701 elseif strcmp(arg,'delay')
wolffd@0 702 if isempty(arg2)
wolffd@0 703 delay;
wolffd@0 704 else
wolffd@0 705 delay(arg2);
wolffd@0 706 end
wolffd@0 707 elseif strcmp(arg,'window');
wolffd@0 708 if isempty(arg2)
wolffd@0 709 window;
wolffd@0 710 else
wolffd@0 711 window(arg2);
wolffd@0 712 end
wolffd@0 713 elseif strcmp(arg,'select');
wolffd@0 714 if isempty(arg2)
wolffd@0 715 select;
wolffd@0 716 else
wolffd@0 717 select(arg2);
wolffd@0 718 end
wolffd@0 719 elseif strcmp(arg,'import')
wolffd@0 720 if isempty(arg2)
wolffd@0 721 import;
wolffd@0 722 else
wolffd@0 723 import(arg2);
wolffd@0 724 end
wolffd@0 725 elseif strcmp(arg,'export')
wolffd@0 726 if isempty(arg2)
wolffd@0 727 export;
wolffd@0 728 else
wolffd@0 729 export(arg2);
wolffd@0 730 end
wolffd@0 731 elseif strcmp(arg,'undo');
wolffd@0 732 if isempty(arg2)
wolffd@0 733 undo;
wolffd@0 734 else
wolffd@0 735 undo(arg2);
wolffd@0 736 end
wolffd@0 737 elseif strcmp(arg,'delay_data')
wolffd@0 738 if isempty(arg2)
wolffd@0 739 delay_data;
wolffd@0 740 else
wolffd@0 741 delay_data(arg2);
wolffd@0 742 end
wolffd@0 743 elseif strcmp(arg,'eval_windowed')
wolffd@0 744 if isempty(arg2)
wolffd@0 745 eval_windowed;
wolffd@0 746 else
wolffd@0 747 eval_windowed(arg2);
wolffd@0 748 end
wolffd@0 749 elseif strcmp(arg,'get_inds')
wolffd@0 750 if isempty(arg2)
wolffd@0 751 get_selected_inds;
wolffd@0 752 else
wolffd@0 753 get_selected_inds(arg2);
wolffd@0 754 end
wolffd@0 755 elseif strcmp(arg,'no_of_sel')
wolffd@0 756 if isempty(arg2)
wolffd@0 757 no_of_selected;
wolffd@0 758 else
wolffd@0 759 no_of_selected(arg2);
wolffd@0 760 end
wolffd@0 761 elseif strcmp(arg,'sel_comp');
wolffd@0 762 if isempty(arg2)
wolffd@0 763 sel_comp;
wolffd@0 764 else
wolffd@0 765 sel_comp(arg2);
wolffd@0 766 end
wolffd@0 767 elseif strcmp(arg,'sel_all_comps')
wolffd@0 768 if isempty(arg2)
wolffd@0 769 select_all_comps;
wolffd@0 770 else
wolffd@0 771 select_all_comps(arg2);
wolffd@0 772 end
wolffd@0 773 elseif strcmp(arg,'refresh')
wolffd@0 774 set_var_names;
wolffd@0 775 elseif any(strcmp(arg,{'close_c','close_d','close_s','close_w','close_sD'}))
wolffd@0 776 if isempty(arg2)
wolffd@0 777 close_func(arg)
wolffd@0 778 else
wolffd@0 779 close_func(arg,arg2);
wolffd@0 780 end
wolffd@0 781 end
wolffd@0 782
wolffd@0 783
wolffd@0 784 switch arg
wolffd@0 785 case 'sD_stats'
wolffd@0 786 sD_stats;
wolffd@0 787 case 'LOG'
wolffd@0 788 log_file;
wolffd@0 789 otherwise
wolffd@0 790 pro_tools(arg);
wolffd@0 791 end
wolffd@0 792 end
wolffd@0 793
wolffd@0 794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 795
wolffd@0 796 function set_compnames(sData,h)
wolffd@0 797
wolffd@0 798 %SET_COMPNAMES
wolffd@0 799 %
wolffd@0 800 % set_compnames(sData,h)
wolffd@0 801 %
wolffd@0 802 % ARGUMENTS
wolffd@0 803 %
wolffd@0 804 % sData (struct) som_data_struct
wolffd@0 805 % h (scalar) handle to a list box object
wolffd@0 806 %
wolffd@0 807 %
wolffd@0 808 % This function sets the component names of sData to the list box
wolffd@0 809 % indicated by 'h'.
wolffd@0 810 %
wolffd@0 811
wolffd@0 812 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 813
wolffd@0 814 if isempty(pre_h)
wolffd@0 815 error('Figure ''Preprocess'' does not exist. Closing program...');
wolffd@0 816 close_preprocess;
wolffd@0 817 end
wolffd@0 818
wolffd@0 819 udata=get(pre_h,'UserData');
wolffd@0 820
wolffd@0 821 set(h,'Value',[]);
wolffd@0 822 for i=1:length(sData.comp_names)
wolffd@0 823 tmp=sprintf('#%d: ',i);
wolffd@0 824 names{i,1}=cat(2,tmp, sData.comp_names{i});
wolffd@0 825 end
wolffd@0 826
wolffd@0 827
wolffd@0 828 set(h,'String',names,'Max',2);
wolffd@0 829 set(udata.sel_comp_h,'String',names);
wolffd@0 830
wolffd@0 831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 832
wolffd@0 833 function draw_vectors(vectors,h)
wolffd@0 834
wolffd@0 835 %DRAW_VECTORS
wolffd@0 836 %
wolffd@0 837 % draw_vectors(vectors,h)
wolffd@0 838 %
wolffd@0 839 % ARGUMENTS
wolffd@0 840 %
wolffd@0 841 % vectors (vector) vector of 0's and 1's
wolffd@0 842 % h (scalar) handle to an axis object
wolffd@0 843 %
wolffd@0 844 %
wolffd@0 845 % This function draws an horizontal bar of 'vectors' in the axis
wolffd@0 846 % indicated by 'h'.
wolffd@0 847 %
wolffd@0 848 %
wolffd@0 849
wolffd@0 850 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 851 subplot(h);
wolffd@0 852 hold off;
wolffd@0 853 cla;
wolffd@0 854
wolffd@0 855 set(h,'YLim',[0 1]);
wolffd@0 856 set(h,'YTick',[]);
wolffd@0 857 set(h,'XLim',[0 length(vectors)+1]);
wolffd@0 858 hold on;
wolffd@0 859
wolffd@0 860 comp_no=get(getfield(get(pre_h,'UserData'),'sel_comp_h'),'Value');
wolffd@0 861 comp=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 862 comp=comp.data(:,comp_no);
wolffd@0 863 Max = max(comp);
wolffd@0 864 Min = min(comp);
wolffd@0 865 lims=get(gca,'YLim');
wolffd@0 866 lims(1)=Min;
wolffd@0 867 h=abs(0.1*Max);
wolffd@0 868 lims(2)=Max;
wolffd@0 869 if Max - Min <= eps
wolffd@0 870 tmp=Max;
wolffd@0 871 lims(1)=tmp-1;
wolffd@0 872 lims(2)=tmp+1;
wolffd@0 873 end
wolffd@0 874 lims(2)=lims(2)+h;
wolffd@0 875 if ~all(isnan(lims))
wolffd@0 876 set(gca,'YLim',lims);
wolffd@0 877 end
wolffd@0 878 h=(lims(2)-lims(1))/4;
wolffd@0 879 set(gca,'YTickMode','auto');
wolffd@0 880 t=1:length(vectors);
wolffd@0 881 h=plot(t,comp);
wolffd@0 882 set(h,'ButtonDownFcn','preprocess(''vector_bdf'',''down'')');
wolffd@0 883 indices =find(vectors);
wolffd@0 884 vectors(indices)=0.1*(getfield(get(gca,'YLim'),...
wolffd@0 885 {2})-getfield(get(gca,'YLim'),{1}));
wolffd@0 886 plot(indices,vectors(indices)+getfield(get(gca,'YLim'),{1}),...
wolffd@0 887 'ored','MarkerSize',4);
wolffd@0 888
wolffd@0 889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 890
wolffd@0 891 function vect_means(sData,handle,indices)
wolffd@0 892
wolffd@0 893 %VECT_MEANS
wolffd@0 894 %
wolffd@0 895 % vect_means(sData,handle,indices)
wolffd@0 896 %
wolffd@0 897 % ARGUMENTS
wolffd@0 898 %
wolffd@0 899 % sData (struct) som_data_struct
wolffd@0 900 % handle (scalar) handle to the static text box object
wolffd@0 901 % indices (vector) indices of selected vectors
wolffd@0 902 %
wolffd@0 903 %
wolffd@0 904 % This function calculates means of selected vectors' components
wolffd@0 905 % and writes them in the static text box indicated by 'handle'.
wolffd@0 906 %
wolffd@0 907 %
wolffd@0 908
wolffd@0 909 sData= sData.data(indices,:);
wolffd@0 910
wolffd@0 911 for i=1:length(sData(1,:))
wolffd@0 912 names{i}=sprintf('#%d: ',i);
wolffd@0 913 end
wolffd@0 914
wolffd@0 915
wolffd@0 916 for i=1:length(sData(1,:))
wolffd@0 917 tmp=sData(:,i);
wolffd@0 918 tmp=cat(2,names{i},sprintf('%-10.3g',mean(tmp(find(~isnan(tmp))))));
wolffd@0 919 string{i}=tmp;
wolffd@0 920 end
wolffd@0 921
wolffd@0 922 set(handle,'String',string);
wolffd@0 923 set(handle,'HorizontalAlignment','left');
wolffd@0 924
wolffd@0 925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 926
wolffd@0 927 function vector_bdf(arg)
wolffd@0 928
wolffd@0 929 %VECTOR_BDF A button down function.
wolffd@0 930 %
wolffd@0 931 % vector_bdf(arg)
wolffd@0 932 %
wolffd@0 933 % ARGUMENTS
wolffd@0 934 %
wolffd@0 935 % arg (string) 'down' or 'up', tells the mouse button's state.
wolffd@0 936 %
wolffd@0 937 %
wolffd@0 938 % This function selects vectors in the vector-window and plots maxima,
wolffd@0 939 % minima and means of the selected vectors. It also writes means of the
wolffd@0 940 % selected vectors' components in a static text box and takes care of
wolffd@0 941 % changes of the chosen component's data.
wolffd@0 942 %
wolffd@0 943 % See also VECTOR_MEANS, SEL_COMP
wolffd@0 944 %
wolffd@0 945 %
wolffd@0 946
wolffd@0 947
wolffd@0 948 arg2=arg(6:length(arg));
wolffd@0 949 if ~isempty(arg2)
wolffd@0 950 LOG=1;
wolffd@0 951 else
wolffd@0 952 LOG=0;
wolffd@0 953 end
wolffd@0 954 arg=arg(1:4);
wolffd@0 955
wolffd@0 956 %%% arg's first "word" is 4 letters long and it can be:
wolffd@0 957 %%%
wolffd@0 958 %%% 'key '
wolffd@0 959 %%% 'down'
wolffd@0 960 %%% 'drag'
wolffd@0 961 %%% 'up '
wolffd@0 962
wolffd@0 963 if strcmp(arg,'key ') %string is 'key' + 1 space!!!
wolffd@0 964 if ~LOG
wolffd@0 965 key=get(gcf,'CurrentCharacter');
wolffd@0 966 else
wolffd@0 967 key=arg2
wolffd@0 968 end
wolffd@0 969 if ~strcmp(key,'<') & ~strcmp(key,'>')
wolffd@0 970 return;
wolffd@0 971 end
wolffd@0 972 data=get(gcf,'UserData');
wolffd@0 973 sel=data.selected_vects;
wolffd@0 974 if length(sel) == 1
wolffd@0 975 if strcmp(key,'<') & sel ~= 1
wolffd@0 976 data.selected_vects=sel-1;
wolffd@0 977 set(gcf,'UserData',data);
wolffd@0 978 elseif strcmp(key,'>') & sel ~= length(data.sData.data(:,1))
wolffd@0 979 data.selected_vects = sel + 1;
wolffd@0 980 set(gcf,'UserData',data);
wolffd@0 981 end
wolffd@0 982 else
wolffd@0 983 if strcmp(key,'<') & sel(1) ~= 1
wolffd@0 984 data.selected_vects=cat(2,sel(1)-1,sel);
wolffd@0 985 set(gcf,'UserData',data);
wolffd@0 986 elseif strcmp(key,'>') & sel(length(sel)) ~= length(sel)
wolffd@0 987 data.selected_vects=cat(2,sel,sel(length(sel))+1);
wolffd@0 988 set(gcf,'UserData',data);
wolffd@0 989 end
wolffd@0 990 end
wolffd@0 991 cplot_mimema;
wolffd@0 992 pro_tools('plot_hist');
wolffd@0 993 pro_tools('c_stat');
wolffd@0 994 vects=zeros(1,length(data.sData.data(:,1)));
wolffd@0 995 vects(data.selected_vects)=1;
wolffd@0 996 draw_vectors(vects,data.vector_h);
wolffd@0 997
wolffd@0 998 if ~LOG
wolffd@0 999 data=get(gcf,'UserData');
wolffd@0 1000 data.LOG{length(data.LOG)+1}=...
wolffd@0 1001 sprintf('preprocess(''vector_bdf'',''key %s'');',key);
wolffd@0 1002 %string is 'key'+2spaces+%s
wolffd@0 1003 set(gcf,'UserData',data);
wolffd@0 1004 end
wolffd@0 1005 return;
wolffd@0 1006 end
wolffd@0 1007
wolffd@0 1008 switch arg
wolffd@0 1009 case 'down'
wolffd@0 1010 set(gcf,'WindowButtonUpFcn','preprocess(''vector_bdf'',''up '')');
wolffd@0 1011 set(gcf,'WindowButtonMotionFcn','preprocess(''vector_bdf'',''drag'')');
wolffd@0 1012 switch get(gcf,'SelectionType')
wolffd@0 1013 case 'normal'
wolffd@0 1014 data.lims1=round(getfield(get(gca,'CurrentPoint'),{1,1}));
wolffd@0 1015 data.lims2=[];
wolffd@0 1016 case 'alt'
wolffd@0 1017 tmp=round(getfield(get(gca,'CurrentPoint'),{1,1}));
wolffd@0 1018 if isempty(get(gca,'UserData'))
wolffd@0 1019 data.lims1=tmp;
wolffd@0 1020 data.lims2=[];
wolffd@0 1021 else
wolffd@0 1022 data.lims1=cat(2,getfield(get(gca,'UserData'),'lims1'),tmp);
wolffd@0 1023 data.lims2=getfield(get(gca,'UserData'),'lims2');
wolffd@0 1024 end
wolffd@0 1025 end
wolffd@0 1026 coords=get(gca,'CurrentPoint');
wolffd@0 1027 h=line([coords(1),coords(1)],get(gca,'YLim'),'EraseMode','xor');
wolffd@0 1028 set(h,'Color','red');
wolffd@0 1029 h2=line([coords(1),coords(1)],get(gca,'YLim'),'EraseMode','xor');
wolffd@0 1030 set(h2,'Color','red');
wolffd@0 1031 data.h=h;
wolffd@0 1032 data.h2=h2;
wolffd@0 1033 set(gca,'UserData',data);
wolffd@0 1034
wolffd@0 1035 case 'drag'
wolffd@0 1036 coords=get(gca,'CurrentPoint');
wolffd@0 1037 lim=get(gca,'XLim');
wolffd@0 1038 h2=getfield(get(gca,'UserData'),'h2');
wolffd@0 1039 if lim(1) >= coords(1)
wolffd@0 1040 set(h2,'XData',[lim(1) lim(1)]);
wolffd@0 1041 elseif lim(2) <= coords(2)
wolffd@0 1042 set(h2,'XData',[lim(2) lim(2)]);
wolffd@0 1043 else
wolffd@0 1044 set(h2,'XData',[coords(1) coords(1)]);
wolffd@0 1045 end
wolffd@0 1046 case 'up ' % string is 'up' + 2 spaces!!!
wolffd@0 1047 set(gcf,'WindowButtonUpFcn','');
wolffd@0 1048 set(gcf,'WindowButtonMotionFcn','');
wolffd@0 1049 if ~LOG
wolffd@0 1050 data=get(gca,'UserData');
wolffd@0 1051 delete(data.h);
wolffd@0 1052 delete(data.h2);
wolffd@0 1053 tmp=round(getfield(get(gca,'CurrentPoint'),{1,1}));
wolffd@0 1054 data.lims2=cat(2,data.lims2,tmp);
wolffd@0 1055 tmp_data=sort(cat(1,data.lims1,data.lims2));
wolffd@0 1056 high=getfield(get(gca,'XLim'),{2})-1;
wolffd@0 1057 vectors=zeros(1,high);
wolffd@0 1058 tmp_data(find(tmp_data<1))=1;
wolffd@0 1059 tmp_data(find(tmp_data>high))=high;
wolffd@0 1060
wolffd@0 1061 for i=1:getfield(size(tmp_data),{2})
wolffd@0 1062 vectors(tmp_data(1,i):tmp_data(2,i))=1;
wolffd@0 1063 end
wolffd@0 1064 selected_vects=find(vectors);
wolffd@0 1065 else
wolffd@0 1066 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1067 len=size(getfield(getfield(get(pre_h,'UserData'),'sData'),'data'));
wolffd@0 1068 vectors=zeros(1,len(1));
wolffd@0 1069 i=1;
wolffd@0 1070 while i <= length(arg2) & (isspace(arg2(i)) | ~isletter(arg2(i)))
wolffd@0 1071 i=i+1;
wolffd@0 1072 end
wolffd@0 1073 arg3=arg2(i:length(arg2));
wolffd@0 1074 selected_vects=str2num(arg2(1:i-1));
wolffd@0 1075 if ~isempty(arg3) & ~all(isspace(arg3))
wolffd@0 1076 selected_vects=unique(cat(2,selected_vects,...
wolffd@0 1077 getfield(get(pre_h,'UserData'),'selected_vects')));
wolffd@0 1078 end
wolffd@0 1079 vectors(selected_vects)=1;
wolffd@0 1080 set(pre_h,'CurrentAxes',getfield(get(pre_h,'UserData'),'vector_h'));
wolffd@0 1081 set(0,'CurrentFigure',pre_h);
wolffd@0 1082 end
wolffd@0 1083 draw_vectors(vectors,gca);
wolffd@0 1084 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 1085 h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 1086 vect_means(sData,h,selected_vects);
wolffd@0 1087 if ~LOG
wolffd@0 1088 set(gca,'UserData',data);
wolffd@0 1089 end
wolffd@0 1090 data=get(gcf,'UserData');
wolffd@0 1091 data.undo.sData=data.sData;
wolffd@0 1092 data.undo.selected=data.selected_vects;
wolffd@0 1093 data.selected_vects=selected_vects;
wolffd@0 1094 if ~LOG
wolffd@0 1095 data.LOG{length(data.LOG)+1}='% Vector selection by using the mouse...';
wolffd@0 1096 tmp=sprintf('preprocess(''vector_bdf'',''up %s'');',...
wolffd@0 1097 num2str(data.selected_vects));
wolffd@0 1098 if length(tmp) > 500
wolffd@0 1099 tmp=textwrap({tmp},500);
wolffd@0 1100 data.LOG{length(data.LOG)+1}=cat(2,tmp{1},''');');
wolffd@0 1101 for i=2:length(tmp)-1
wolffd@0 1102 data.LOG{length(data.LOG)+1}=...
wolffd@0 1103 cat(2,sprintf('preprocess(''vector_bdf'',''up %s',...
wolffd@0 1104 tmp{i}),'add'');');
wolffd@0 1105 end
wolffd@0 1106 data.LOG{length(data.LOG)+1}=...
wolffd@0 1107 cat(2,sprintf('preprocess(''vector_bdf'',''up %s',...
wolffd@0 1108 tmp{length(tmp)}(1:length(tmp{length(tmp)})-3)),' add'');');
wolffd@0 1109 else
wolffd@0 1110 data.LOG{length(data.LOG)+1}=tmp;
wolffd@0 1111 end
wolffd@0 1112 end
wolffd@0 1113 set(gcf,'UserData',data);
wolffd@0 1114 cplot_mimema;
wolffd@0 1115 sel_comp;
wolffd@0 1116 end
wolffd@0 1117
wolffd@0 1118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1119
wolffd@0 1120 function sel_button(varargin)
wolffd@0 1121
wolffd@0 1122 %SEL_BUTTON A Callback function. It performs the operations needed
wolffd@0 1123 % when vector components are selected.
wolffd@0 1124 %
wolffd@0 1125 % See also SEL_COMP
wolffd@0 1126 %
wolffd@0 1127
wolffd@0 1128 if nargin == 1
wolffd@0 1129 LOG=1;
wolffd@0 1130 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1131 string=getfield(get(pre_h,'UserData'),'comp_names_h');
wolffd@0 1132 string=getfield(get(string,'String'),{str2num(varargin{1})});
wolffd@0 1133 set(0,'CurrentFigure',pre_h);
wolffd@0 1134 else
wolffd@0 1135 LOG=0;
wolffd@0 1136 val=get(getfield(get(gcf,'UserData'),'comp_names_h'),'Value');
wolffd@0 1137 end
wolffd@0 1138
wolffd@0 1139 sel_button_h=getfield(get(gcf,'UserData'),'sel_button_h');
wolffd@0 1140 sel_comps_h=getfield(get(gcf,'UserData'),'sel_comps_h');
wolffd@0 1141 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 1142 if ~LOG
wolffd@0 1143 string=getfield(get(comp_names_h,'String'),{get(comp_names_h,'Value')});
wolffd@0 1144 end
wolffd@0 1145 tmp_string=get(sel_comps_h,'String');
wolffd@0 1146
wolffd@0 1147 if iscell(tmp_string)
wolffd@0 1148
wolffd@0 1149 for i=1:length(string)
wolffd@0 1150 if ~any(strcmp(string{i},tmp_string))
wolffd@0 1151 tmp_string=cat(1,tmp_string,string(i));
wolffd@0 1152 end
wolffd@0 1153 end
wolffd@0 1154 string=tmp_string;
wolffd@0 1155 end
wolffd@0 1156
wolffd@0 1157 set(sel_comps_h,'String',string);
wolffd@0 1158 set(comp_names_h,'Value',[]);
wolffd@0 1159 sel_comp;
wolffd@0 1160 if ~LOG
wolffd@0 1161 data=get(gcf,'UserData');
wolffd@0 1162 data.LOG{length(data.LOG)+1}='% Select components';
wolffd@0 1163 data.LOG{length(data.LOG)+1}=sprintf('preprocess(''sel_button'',''%s'');',...
wolffd@0 1164 num2str(val));
wolffd@0 1165 set(gcf,'UserData',data);
wolffd@0 1166 end
wolffd@0 1167
wolffd@0 1168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1169
wolffd@0 1170 function clear_button(varargin)
wolffd@0 1171
wolffd@0 1172 %CLEAR_BUTTON Function callback evaluated when a 'Clear'-button is
wolffd@0 1173 % pressed. It removes texts from the 'selected components'
wolffd@0 1174 % -window and the 'selected component data' -window and
wolffd@0 1175 % clears the 'histogram' -axis.
wolffd@0 1176 %
wolffd@0 1177 %
wolffd@0 1178
wolffd@0 1179 if nargin==1
wolffd@0 1180 LOG=1;
wolffd@0 1181 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1182 set(0,'CurrentFigure',pre_h);
wolffd@0 1183 else
wolffd@0 1184 LOG=0;
wolffd@0 1185 end
wolffd@0 1186
wolffd@0 1187 sel_comp_h=getfield(get(gcf,'UserData'),'sel_comp_h');
wolffd@0 1188 sel_cdata_h=getfield(get(gcf,'UserData'),'sel_cdata_h');
wolffd@0 1189 sel_cplot_h=getfield(get(gcf,'UserData'),'sel_cplot_h');
wolffd@0 1190 sel_chist_h=getfield(get(gcf,'UserData'),'sel_chist_h');
wolffd@0 1191 vector_h=getfield(get(gcf,'UserData'),'vector_h');
wolffd@0 1192
wolffd@0 1193 set(sel_comp_h,'Value',1);
wolffd@0 1194 set(sel_cdata_h,'String',' ');
wolffd@0 1195 subplot(sel_chist_h);
wolffd@0 1196 hold off;
wolffd@0 1197 cla;
wolffd@0 1198
wolffd@0 1199 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 1200 dims=size(getfield(getfield(get(gcf,'UserData'),'sData'),'data'));
wolffd@0 1201 vectors=zeros(1,dims(1));
wolffd@0 1202 vectors(selected)=1;
wolffd@0 1203 subplot(vector_h);
wolffd@0 1204 draw_vectors(vectors,vector_h);
wolffd@0 1205 if ~LOG
wolffd@0 1206 data=get(gcf,'UserData');
wolffd@0 1207 data.LOG{length(data.LOG)+1}='% Remove components from the selected list.';
wolffd@0 1208 data.LOG{length(data.LOG)+1}='preprocess(''clear_button'',''foo'');';
wolffd@0 1209 set(gcf,'UserData',data);
wolffd@0 1210 end
wolffd@0 1211
wolffd@0 1212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1213
wolffd@0 1214 function sel_comp(varargin)
wolffd@0 1215
wolffd@0 1216 %SEL_COMP performs the operations needed when vector components are
wolffd@0 1217 % chosen. It writes maxima, minima, mean and standard deviation
wolffd@0 1218 % of the chosen component to a text box window and draws a
wolffd@0 1219 % histogram of the chosen component of selected vectors'
wolffd@0 1220 %
wolffd@0 1221 %
wolffd@0 1222
wolffd@0 1223 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1224 set(0,'CurrentFigure',pre_h);
wolffd@0 1225 sel_comp_h=getfield(get(pre_h,'UserData'),'sel_comp_h');
wolffd@0 1226
wolffd@0 1227 if nargin == 1
wolffd@0 1228 set(sel_comp_h,'Value',str2num(varargin{1}));
wolffd@0 1229 elseif ~isempty(gcbo)
wolffd@0 1230 no=get(sel_comp_h,'Value');
wolffd@0 1231 data=get(gcf,'UserData');
wolffd@0 1232 data.LOG{length(data.LOG)+1}='% Select one component';
wolffd@0 1233 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''sel_comp'',''',...
wolffd@0 1234 num2str(no),''');');
wolffd@0 1235 set(gcf,'UserData',data);
wolffd@0 1236 end
wolffd@0 1237
wolffd@0 1238 pro_tools('c_stat');
wolffd@0 1239 pro_tools('plot_hist');
wolffd@0 1240 data=get(gcf,'UserData');
wolffd@0 1241 sData=data.sData;
wolffd@0 1242 vector_h=data.vector_h;
wolffd@0 1243 len=length(sData.data(:,1));
wolffd@0 1244 vects=zeros(1,len);
wolffd@0 1245 vects(data.selected_vects)=1;
wolffd@0 1246 draw_vectors(vects,vector_h);
wolffd@0 1247
wolffd@0 1248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1249
wolffd@0 1250 function cplot_mimema
wolffd@0 1251
wolffd@0 1252 global no_of_sc
wolffd@0 1253
wolffd@0 1254 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 1255 sel_cplot_h=getfield(get(gcf,'UserData'),'sel_cplot_h');
wolffd@0 1256 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 1257
wolffd@0 1258 set(sel_cplot_h,'YLim',[0 length(sData.data(1,:))+1]);
wolffd@0 1259
wolffd@0 1260 subplot(sel_cplot_h);
wolffd@0 1261 hold off;
wolffd@0 1262 cla;
wolffd@0 1263 hold on;
wolffd@0 1264
wolffd@0 1265 for i=1:length(sData.data(1,:))
wolffd@0 1266 Max=max(sData.data(:,i));
wolffd@0 1267 Min=min(sData.data(:,i));
wolffd@0 1268 tmp=sData.data(selected,i);
wolffd@0 1269
wolffd@0 1270 selMax=max(tmp);
wolffd@0 1271 selMin=min(tmp);
wolffd@0 1272 Mean=abs(mean(tmp(find(~isnan(tmp)))));
wolffd@0 1273 Median=abs(median(tmp(find(~isnan(tmp)))));
wolffd@0 1274
wolffd@0 1275 if Max ~= Min & ~all(isnan(sData.data(:,i)))
wolffd@0 1276
wolffd@0 1277 if rem(i,no_of_sc) % no_of_sc is defined in the beginning of this file...
wolffd@0 1278
wolffd@0 1279 line([abs(selMin-Min)/(Max-Min) (selMax-Min)/(Max-Min)],...
wolffd@0 1280 [i i],'Color','black');
wolffd@0 1281 plot(abs(Mean-Min)/(Max-Min),i,'oblack');
wolffd@0 1282 plot(abs(Median-Min)/(Max-Min),i,'xblack');
wolffd@0 1283 else
wolffd@0 1284 line([abs(selMin-Min)/(Max-Min) (selMax-Min)/(Max-Min)],...
wolffd@0 1285 [i i],'Color','black','LineWidth',2);
wolffd@0 1286 plot(abs(Mean-Min)/(Max-Min),i,'oblack','LineWidth',2);
wolffd@0 1287 plot(abs(Median-Min)/(Max-Min),i,'xblack','LineWidth',2);
wolffd@0 1288 end
wolffd@0 1289 else
wolffd@0 1290
wolffd@0 1291 if rem(i,no_of_sc) % N is defined in the beginning of this file.
wolffd@0 1292
wolffd@0 1293 plot(mean(get(gca,'XLim')),i,'oblack');
wolffd@0 1294 plot(mean(get(gca,'XLim')),i,'xblack');
wolffd@0 1295 else
wolffd@0 1296 plot(mean(get(gca,'XLim')),i,'oblack','LineWidth',2);
wolffd@0 1297 plot(mean(get(gca,'XLim')),i,'xblack','LineWidth',2);
wolffd@0 1298 end
wolffd@0 1299 end
wolffd@0 1300 end
wolffd@0 1301
wolffd@0 1302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1303
wolffd@0 1304
wolffd@0 1305 function bool=set_sD_stats
wolffd@0 1306
wolffd@0 1307 %SET_SD_STATS Writes the data set names to popup menu.
wolffd@0 1308 %
wolffd@0 1309 %
wolffd@0 1310
wolffd@0 1311 bool=1;
wolffd@0 1312 data=get(gcf,'UserData');
wolffd@0 1313
wolffd@0 1314 for i=1:length(data.sD_set)
wolffd@0 1315 % if ~isvalid_var_name({data.sD_set(i).name})
wolffd@0 1316 % close_preprocess;
wolffd@0 1317 % bool=0;
wolffd@0 1318 % return;
wolffd@0 1319 % end
wolffd@0 1320 string{i}=cat(2,sprintf('#%d: ',i),data.sD_set(i).name);
wolffd@0 1321 end
wolffd@0 1322
wolffd@0 1323 set(data.sD_set_h,'String',string);
wolffd@0 1324 data.sData=data.sD_set(get(data.sD_set_h,'Value'));
wolffd@0 1325 data.sData.MODIFIED=0;
wolffd@0 1326 data.sData.INDEX=1;
wolffd@0 1327 set(gcf,'UserData',data);
wolffd@0 1328 write_sD_stats;
wolffd@0 1329
wolffd@0 1330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1331
wolffd@0 1332 function write_sD_stats
wolffd@0 1333
wolffd@0 1334 %WRITE_SD_STATS writes data's name, length and dimension to text box.
wolffd@0 1335 %
wolffd@0 1336 %
wolffd@0 1337
wolffd@0 1338 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1339
wolffd@0 1340
wolffd@0 1341 sD_name_h=getfield(get(pre_h,'UserData'),'sD_name_h');
wolffd@0 1342 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 1343 dims=size(sData.data);
wolffd@0 1344 string{1}=cat(2,'Name: ',sData.name);
wolffd@0 1345 string{2}=cat(2,'Length: ',sprintf('%d',dims(1)));
wolffd@0 1346 string{3}=cat(2,'Dim: ',sprintf('%d',dims(2)));
wolffd@0 1347
wolffd@0 1348 set(sD_name_h,'String',string);
wolffd@0 1349 set(sD_name_h,'HorizontalAlignment','left');
wolffd@0 1350
wolffd@0 1351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1352
wolffd@0 1353
wolffd@0 1354
wolffd@0 1355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1356
wolffd@0 1357 function sel_sD(varargin)
wolffd@0 1358
wolffd@0 1359 %SEL_SD sets new data to UserData's 'sData'.
wolffd@0 1360 %
wolffd@0 1361 %
wolffd@0 1362
wolffd@0 1363 if nargin==1
wolffd@0 1364 LOG=1;
wolffd@0 1365 index=str2num(varargin{1});
wolffd@0 1366 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1367 set(0,'CurrentFigure',pre_h);
wolffd@0 1368 else
wolffd@0 1369 LOG=0;
wolffd@0 1370 end
wolffd@0 1371
wolffd@0 1372 sD_set_h=getfield(get(gcf,'UserData'),'sD_set_h');
wolffd@0 1373 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 1374 vector_h=getfield(get(gcf,'UserData'),'vector_h');
wolffd@0 1375 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 1376
wolffd@0 1377 if ~LOG
wolffd@0 1378 index=get(sD_set_h,'Value');
wolffd@0 1379 end
wolffd@0 1380 data=get(gcf,'UserData');
wolffd@0 1381 data.undo = [];
wolffd@0 1382 INDEX=data.sData.INDEX;
wolffd@0 1383 data.sData=rmfield(data.sData,'MODIFIED');
wolffd@0 1384 data.sData=rmfield(data.sData,'INDEX');
wolffd@0 1385
wolffd@0 1386 tmp=data.sD_set(index);
wolffd@0 1387 tmp.MODIFIED=0;
wolffd@0 1388 tmp.INDEX=index;
wolffd@0 1389 data.sD_set(INDEX)=data.sData;
wolffd@0 1390 data.sData=tmp;
wolffd@0 1391
wolffd@0 1392 len=getfield(size(tmp.data),{1});
wolffd@0 1393
wolffd@0 1394 data.selected_vects=find(ones(1,len));
wolffd@0 1395 if ~LOG
wolffd@0 1396 data.LOG{length(data.LOG)+1}='% Select a new data set.';
wolffd@0 1397 data.LOG{length(data.LOG)+1}=sprintf('preprocess(''sel_sD'',''%s'');',...
wolffd@0 1398 num2str(index));
wolffd@0 1399 end
wolffd@0 1400 set(gcf,'UserData',data);
wolffd@0 1401 write_sD_stats;
wolffd@0 1402 set_compnames(tmp,comp_names_h);
wolffd@0 1403 draw_vectors(ones(1,len),vector_h);
wolffd@0 1404 vect_means(tmp,vect_mean_h,data.selected_vects);
wolffd@0 1405 clear_button;
wolffd@0 1406 sel_comp;
wolffd@0 1407 cplot_mimema;
wolffd@0 1408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1409
wolffd@0 1410 function indices=get_indices
wolffd@0 1411
wolffd@0 1412 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1413
wolffd@0 1414 comp_names_h=getfield(get(pre_h,'UserData'),'comp_names_h');
wolffd@0 1415 indices = get(comp_names_h,'Value');
wolffd@0 1416
wolffd@0 1417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1418
wolffd@0 1419
wolffd@0 1420
wolffd@0 1421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1422
wolffd@0 1423 function sD_management(varargin)
wolffd@0 1424
wolffd@0 1425 if nargin ~= 1
wolffd@0 1426 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1427 preh_udata=get(pre_h,'UserData');
wolffd@0 1428 preh_udata.LOG{length(preh_udata.LOG)+1}=...
wolffd@0 1429 '% Starting the ''Data Set Management'' -window...';
wolffd@0 1430 preh_udata.LOG{length(preh_udata.LOG)+1}=...
wolffd@0 1431 'preprocess(''sD_management'',''foo'');';
wolffd@0 1432 set(pre_h,'UserData',preh_udata);
wolffd@0 1433 end
wolffd@0 1434
wolffd@0 1435 man_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 1436 if ~isempty(man_h)
wolffd@0 1437 figure(man_h);
wolffd@0 1438 return;
wolffd@0 1439 end
wolffd@0 1440
wolffd@0 1441 h0 = figure('BackingStore','off', ...
wolffd@0 1442 'Color',[0.8 0.8 0.8], ...
wolffd@0 1443 'Name','Data Set Management', ...
wolffd@0 1444 'PaperPosition',[18 180 576 432], ...
wolffd@0 1445 'PaperUnits','points', ...
wolffd@0 1446 'Position',[753 523 324 470], ...
wolffd@0 1447 'RendererMode','manual', ...
wolffd@0 1448 'Tag','Management');
wolffd@0 1449 h1 = uicontrol('Parent',h0, ...
wolffd@0 1450 'Units','normalized', ...
wolffd@0 1451 'BackgroundColor',[1 1 1], ...
wolffd@0 1452 'FontWeight','demi', ...
wolffd@0 1453 'HorizontalAlignment','left', ...
wolffd@0 1454 'ListboxTop',0, ...
wolffd@0 1455 'Max',2, ...
wolffd@0 1456 'Position',[0.02777777777777778 0.0723404255319149 0.7716049382716049 0.1914893617021277], ...
wolffd@0 1457 'String',' ', ...
wolffd@0 1458 'Style','edit', ...
wolffd@0 1459 'Tag','EditText1');
wolffd@0 1460
wolffd@0 1461 data.new_c_name_h = h1;
wolffd@0 1462
wolffd@0 1463 h1 = uicontrol('Parent',h0, ...
wolffd@0 1464 'Callback','preprocess rename comp',...
wolffd@0 1465 'Units','normalized', ...
wolffd@0 1466 'FontSize',6, ...
wolffd@0 1467 'FontWeight','demi', ...
wolffd@0 1468 'ListboxTop',0, ...
wolffd@0 1469 'Position',[0.8240740740740741 0.2106382978723404 0.154320987654321 0.05319148936170213], ...
wolffd@0 1470 'String','RENAME', ...
wolffd@0 1471 'Tag','Pushbutton1');
wolffd@0 1472
wolffd@0 1473 h1 = uicontrol('Parent',h0, ...
wolffd@0 1474 'Callback','preprocess close_sD',...
wolffd@0 1475 'Units','normalized', ...
wolffd@0 1476 'FontWeight','demi', ...
wolffd@0 1477 'ListboxTop',0, ...
wolffd@0 1478 'Position',[0.8240740740740741 0.01914893617021277 0.154320987654321 0.05319148936170213], ...
wolffd@0 1479 'String','CLOSE', ...
wolffd@0 1480 'Tag','Pushbutton2');
wolffd@0 1481 h1 = uicontrol('Parent',h0, ...
wolffd@0 1482 'Units','normalized', ...
wolffd@0 1483 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 1484 'FontWeight','demi', ...
wolffd@0 1485 'HorizontalAlignment','left', ...
wolffd@0 1486 'ListboxTop',0, ...
wolffd@0 1487 'Position',[0.02777777777777778 0.2680851063829787 0.345679012345679 0.02978723404255319], ...
wolffd@0 1488 'String','COMPONENTS:', ...
wolffd@0 1489 'Style','text', ...
wolffd@0 1490 'Tag','StaticText1');
wolffd@0 1491 h1 = uicontrol('Parent',h0, ...
wolffd@0 1492 'Units','normalized', ...
wolffd@0 1493 'BackgroundColor',[1 1 1], ...
wolffd@0 1494 'HorizontalAlignment','left', ...
wolffd@0 1495 'Position',[0.02777777777777778 0.3170212765957447 0.3549382716049382 0.5319148936170213], ...
wolffd@0 1496 'String',' ', ...
wolffd@0 1497 'Style','listbox', ...
wolffd@0 1498 'Tag','Listbox1', ...
wolffd@0 1499 'Value',1);
wolffd@0 1500
wolffd@0 1501 data.sets_h=h1;
wolffd@0 1502
wolffd@0 1503 h1 = uicontrol('Parent',h0, ...
wolffd@0 1504 'Units','normalized', ...
wolffd@0 1505 'BackgroundColor',[1 1 1], ...
wolffd@0 1506 'HorizontalAlignment','left', ...
wolffd@0 1507 'Position',[0.6234567901234568 0.3170212765957447 0.3549382716049382 0.5319148936170213], ...
wolffd@0 1508 'String',' ', ...
wolffd@0 1509 'Style','listbox', ...
wolffd@0 1510 'Tag','Listbox2', ...
wolffd@0 1511 'Value',1);
wolffd@0 1512
wolffd@0 1513
wolffd@0 1514 data.variables_h = h1;
wolffd@0 1515
wolffd@0 1516 h1 = uicontrol('Parent',h0, ...
wolffd@0 1517 'Callback','preprocess export',...
wolffd@0 1518 'Units','normalized', ...
wolffd@0 1519 'FontWeight','demi', ...
wolffd@0 1520 'ListboxTop',0, ...
wolffd@0 1521 'Position',[0.4259259259259259 0.551063829787234 0.154320987654321 0.0425531914893617], ...
wolffd@0 1522 'String','->', ...
wolffd@0 1523 'Tag','Pushbutton4');
wolffd@0 1524
wolffd@0 1525 h1 = uicontrol('Parent',h0, ...
wolffd@0 1526 'Callback','preprocess import',...
wolffd@0 1527 'Units','normalized', ...
wolffd@0 1528 'FontWeight','demi', ...
wolffd@0 1529 'ListboxTop',0, ...
wolffd@0 1530 'Position',[0.4259259259259259 0.625531914893617 0.154320987654321 0.0425531914893617], ...
wolffd@0 1531 'String','<-', ...
wolffd@0 1532 'Tag','Pushbutton3');
wolffd@0 1533
wolffd@0 1534
wolffd@0 1535
wolffd@0 1536 h1 = uicontrol('Parent',h0, ...
wolffd@0 1537 'Units','normalized', ...
wolffd@0 1538 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 1539 'FontWeight','demi', ...
wolffd@0 1540 'HorizontalAlignment','left', ...
wolffd@0 1541 'ListboxTop',0, ...
wolffd@0 1542 'Position',[0.02777777777777778 0.8531914893617022 0.2993827160493827 0.02978723404255319], ...
wolffd@0 1543 'String','DATA SETS', ...
wolffd@0 1544 'Style','text', ...
wolffd@0 1545 'Tag','StaticText2');
wolffd@0 1546
wolffd@0 1547 h1 = uicontrol('Parent',h0, ...
wolffd@0 1548 'Units','normalized', ...
wolffd@0 1549 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 1550 'FontWeight','demi', ...
wolffd@0 1551 'HorizontalAlignment','left', ...
wolffd@0 1552 'ListboxTop',0, ...
wolffd@0 1553 'Position',[0.6234567901234568 0.8531914893617022 0.2561728395061728 0.02978723404255319], ...
wolffd@0 1554 'String','WORKSPACE', ...
wolffd@0 1555 'Style','text', ...
wolffd@0 1556 'Tag','StaticText3');
wolffd@0 1557
wolffd@0 1558 h1 = uicontrol('Parent',h0, ...
wolffd@0 1559 'Callback','preprocess rename set',...
wolffd@0 1560 'Units','normalized', ...
wolffd@0 1561 'BackgroundColor',[1 1 1], ...
wolffd@0 1562 'HorizontalAlignment','left', ...
wolffd@0 1563 'ListboxTop',0, ...
wolffd@0 1564 'Position',[0.1820987654320987 0.9127659574468086 0.7808641975308641 0.0425531914893617], ...
wolffd@0 1565 'Style','edit', ...
wolffd@0 1566 'Tag','EditText2');
wolffd@0 1567
wolffd@0 1568 data.new_name_h = h1;
wolffd@0 1569
wolffd@0 1570
wolffd@0 1571 h1 = uicontrol('Parent',h0, ...
wolffd@0 1572 'Units','normalized', ...
wolffd@0 1573 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 1574 'FontWeight','demi', ...
wolffd@0 1575 'HorizontalAlignment','left', ...
wolffd@0 1576 'ListboxTop',0, ...
wolffd@0 1577 'Position',[0.02777777777777778 0.9127659574468086 0.1388888888888889 0.02978723404255319], ...
wolffd@0 1578 'String','NAME:', ...
wolffd@0 1579 'Style','text', ...
wolffd@0 1580 'Tag','StaticText4');
wolffd@0 1581
wolffd@0 1582
wolffd@0 1583 ui_h=uimenu('Label','&Tools');
wolffd@0 1584 uimenu(ui_h,'Label','Copy','Callback','preprocess copy_delete copy');
wolffd@0 1585 uimenu(ui_h,'Label','Delete','Callback','preprocess copy_delete delete');
wolffd@0 1586 uimenu(ui_h,'Label','Refresh','Callback','preprocess refresh');
wolffd@0 1587
wolffd@0 1588 set(gcf,'UserData',data);
wolffd@0 1589 set_var_names;
wolffd@0 1590 sD_names;
wolffd@0 1591 sD_stats;
wolffd@0 1592
wolffd@0 1593
wolffd@0 1594
wolffd@0 1595 %%% Subfunction: set_var_names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1596
wolffd@0 1597 function set_var_names
wolffd@0 1598
wolffd@0 1599
wolffd@0 1600 variables_h=getfield(get(gcf,'UserData'),'variables_h');
wolffd@0 1601 value=get(variables_h,'Value');
wolffd@0 1602 len=evalin('base','length(who)');
wolffd@0 1603
wolffd@0 1604 names=cell(len,1);
wolffd@0 1605
wolffd@0 1606 for i=1:len
wolffd@0 1607 string=cat(2,'getfield(who,{',num2str(i),'})');
wolffd@0 1608 names(i)=evalin('base',string);
wolffd@0 1609 end
wolffd@0 1610
wolffd@0 1611 set(variables_h,'String',names);
wolffd@0 1612 if(value > length(names))
wolffd@0 1613 set(variables_h,'Value',1);
wolffd@0 1614 end
wolffd@0 1615
wolffd@0 1616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1617
wolffd@0 1618 %%% Subfunction: sD_names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1619
wolffd@0 1620 function sD_names
wolffd@0 1621
wolffd@0 1622 sets_h=getfield(get(gcf,'UserData'),'sets_h');
wolffd@0 1623 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1624
wolffd@0 1625 sD_set = getfield(get(pre_h,'UserData'),'sD_set');
wolffd@0 1626
wolffd@0 1627 for i=1:length(sD_set)
wolffd@0 1628 names{i,1}=cat(2,sprintf('#%d: ',i),sD_set(i).name);
wolffd@0 1629 end
wolffd@0 1630
wolffd@0 1631 set(sets_h,'String',names);
wolffd@0 1632
wolffd@0 1633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1634
wolffd@0 1635 %%% Subfunction: sD_stats %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1636
wolffd@0 1637 function sD_stats
wolffd@0 1638
wolffd@0 1639 man_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 1640 c_names_h=getfield(get(man_h,'UserData'),'new_c_name_h');
wolffd@0 1641 sD_name_h=getfield(get(man_h,'UserData'),'new_name_h');
wolffd@0 1642 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1643 INDEX=getfield(getfield(get(pre_h,'UserData'),'sData'),'INDEX');
wolffd@0 1644 MODIFIED=getfield(getfield(get(pre_h,'UserData'),'sData'),'MODIFIED');
wolffd@0 1645 value=get(getfield(get(man_h,'UserData'),'sets_h'),'Value');
wolffd@0 1646
wolffd@0 1647 if value==INDEX
wolffd@0 1648 data=get(pre_h,'UserData');
wolffd@0 1649 sData=rmfield(data.sData,[{'INDEX'};{'MODIFIED'}]);
wolffd@0 1650 data.sD_set(INDEX)=sData;
wolffd@0 1651 data.sData.MODIFIED=0;
wolffd@0 1652 set(pre_h,'UserData',data);
wolffd@0 1653 end
wolffd@0 1654
wolffd@0 1655 sData=getfield(getfield(get(pre_h,'UserData'),'sD_set'),{value});
wolffd@0 1656 string1=[{sData.name}];
wolffd@0 1657
wolffd@0 1658
wolffd@0 1659 set(sD_name_h,'String',string1);
wolffd@0 1660 set(c_names_h,'String',sData.comp_names);
wolffd@0 1661
wolffd@0 1662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1663
wolffd@0 1664 %%% Subfunction: import %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1665
wolffd@0 1666 function import(varargin)
wolffd@0 1667
wolffd@0 1668 if nargin==1
wolffd@0 1669 LOG=1;
wolffd@0 1670 man_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 1671 set(0,'CurrentFigure',man_h);
wolffd@0 1672 name=varargin;
wolffd@0 1673 else
wolffd@0 1674 LOG=0;
wolffd@0 1675 end
wolffd@0 1676
wolffd@0 1677 variables_h=getfield(get(gcf,'UserData'),'variables_h');
wolffd@0 1678 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1679 if ~LOG
wolffd@0 1680 name=getfield(get(variables_h,'String'),{get(variables_h,'Value')});
wolffd@0 1681 end
wolffd@0 1682 errstr='Data to be imported must be real matrix or ''som_data_struct''.';
wolffd@0 1683 new_sD=evalin('base',name{1});
wolffd@0 1684
wolffd@0 1685 if isempty(pre_h)
wolffd@0 1686 errordlg('''Preprocess'' -figure does not exist. Terminating program...');
wolffd@0 1687 close_preprocess;
wolffd@0 1688 return;
wolffd@0 1689 end
wolffd@0 1690
wolffd@0 1691 if isstr(new_sD) | (~isstruct(new_sD) & ~isreal(new_sD))
wolffd@0 1692 errordlg(errstr);
wolffd@0 1693 return;
wolffd@0 1694 elseif isstruct(new_sD) & length(new_sD) > 1
wolffd@0 1695 errordlg(errstr)
wolffd@0 1696 return;
wolffd@0 1697 elseif ~isstruct(new_sD)
wolffd@0 1698 new_sD=som_data_struct(new_sD);
wolffd@0 1699 new_sD.name=name{1};
wolffd@0 1700 end
wolffd@0 1701
wolffd@0 1702 new_sD_names=fieldnames(new_sD);
wolffd@0 1703 right_names=fieldnames(som_data_struct(1));
wolffd@0 1704 for i=1:length(new_sD_names)
wolffd@0 1705 if ~any(strcmp(new_sD_names(i),right_names));
wolffd@0 1706 errordlg(errstr);
wolffd@0 1707 return;
wolffd@0 1708 end
wolffd@0 1709 end
wolffd@0 1710
wolffd@0 1711 data=get(pre_h,'UserData');
wolffd@0 1712 data.sD_set(length(data.sD_set) + 1)=new_sD;
wolffd@0 1713 if ~LOG
wolffd@0 1714 data.LOG{length(data.LOG)+1}='% Import a data set from the workspace.';
wolffd@0 1715 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''import'',''',...
wolffd@0 1716 name{1},''');');
wolffd@0 1717 end
wolffd@0 1718 set(pre_h,'UserData',data);
wolffd@0 1719 sD_names;
wolffd@0 1720 sD_stats;
wolffd@0 1721 old =gcf;
wolffd@0 1722 set(0,'CurrentFigure',pre_h);
wolffd@0 1723 set_sD_stats;
wolffd@0 1724 set(0,'CurrentFigure',old);
wolffd@0 1725
wolffd@0 1726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1727
wolffd@0 1728 %%% Subfunction: export %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1729
wolffd@0 1730 function export(varargin)
wolffd@0 1731
wolffd@0 1732 if nargin == 1
wolffd@0 1733 LOG=1;
wolffd@0 1734 man_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 1735 set(0,'CurrentFigure',man_h);
wolffd@0 1736 index=str2num(varargin{1});
wolffd@0 1737 else
wolffd@0 1738 LOG=0;
wolffd@0 1739 end
wolffd@0 1740
wolffd@0 1741 sets_h=getfield(get(gcf,'UserData'),'sets_h');
wolffd@0 1742 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1743
wolffd@0 1744 if ~LOG
wolffd@0 1745 index=get(sets_h,'Value');
wolffd@0 1746 end
wolffd@0 1747
wolffd@0 1748 if isempty(pre_h)
wolffd@0 1749 errordlg('''Preprocess''-figure does not exist. Terminating program...');
wolffd@0 1750 close(findobj(get(0,'Children'),'Tag','Management'));
wolffd@0 1751 close(findobj(get(0,'Children'),'Tag','PlotWin'));
wolffd@0 1752 return;
wolffd@0 1753 end
wolffd@0 1754
wolffd@0 1755 sData=getfield(getfield(get(pre_h,'UserData'),'sD_set'),{index});
wolffd@0 1756
wolffd@0 1757 if ~isvalid_var_name({sData.name})
wolffd@0 1758 return;
wolffd@0 1759 end
wolffd@0 1760
wolffd@0 1761 assignin('base',sData.name,sData);
wolffd@0 1762 disp(sprintf('Data set ''%s'' is set to the workspace.',sData.name));
wolffd@0 1763 if ~LOG
wolffd@0 1764 data=get(pre_h,'UserData');
wolffd@0 1765 data.LOG{length(data.LOG)+1}='% Export a data set to the workspace.';
wolffd@0 1766 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''export'',''',...
wolffd@0 1767 num2str(index),''');');
wolffd@0 1768 set(pre_h,'UserData',data);
wolffd@0 1769 end
wolffd@0 1770 set_var_names;
wolffd@0 1771
wolffd@0 1772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1773
wolffd@0 1774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1775 %%% Subfunction: rename %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1776
wolffd@0 1777 function rename(arg)
wolffd@0 1778
wolffd@0 1779 i=1;
wolffd@0 1780 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 1781 i=i+1;
wolffd@0 1782 end
wolffd@0 1783
wolffd@0 1784 arg2=arg(i+1:length(arg));
wolffd@0 1785 arg=arg(1:i-1);
wolffd@0 1786 if ~isempty(arg2)
wolffd@0 1787 LOG=1;
wolffd@0 1788 i=1;
wolffd@0 1789 if arg2(1) ~= '{'
wolffd@0 1790 while i <= length(arg2) & arg2(i) ~= ' '
wolffd@0 1791 i=i+1;
wolffd@0 1792 end
wolffd@0 1793 index=str2num(arg2(i+1:length(arg2)));
wolffd@0 1794 arg2=arg2(1:i-1);
wolffd@0 1795 else
wolffd@0 1796 while i <= length(arg2) & arg2(i) ~= '}'
wolffd@0 1797 i=i+1;
wolffd@0 1798 end
wolffd@0 1799 index=str2num(arg2(i+1:length(arg2)));
wolffd@0 1800 arg2=arg2(1:i);
wolffd@0 1801 end
wolffd@0 1802 else
wolffd@0 1803 LOG=0;
wolffd@0 1804 end
wolffd@0 1805
wolffd@0 1806 new_name_h=getfield(get(gcf,'UserData'),'new_name_h');
wolffd@0 1807 new_c_name_h=getfield(get(gcf,'UserData'),'new_c_name_h');
wolffd@0 1808 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1809
wolffd@0 1810 if isempty(pre_h)
wolffd@0 1811 errordlg('''Preprocess'' -figure does not exist. Terminating program...');
wolffd@0 1812 close_preprocess;
wolffd@0 1813 return;
wolffd@0 1814 end
wolffd@0 1815
wolffd@0 1816 switch arg
wolffd@0 1817 case 'set'
wolffd@0 1818 if LOG
wolffd@0 1819 name={arg2};
wolffd@0 1820 else
wolffd@0 1821 name=get(new_name_h,'String');
wolffd@0 1822 end
wolffd@0 1823 if ~isempty(name{1}) & ~any(isspace(name{1}))
wolffd@0 1824 if ~isvalid_var_name(name)
wolffd@0 1825 sD_stats;
wolffd@0 1826 return;
wolffd@0 1827 end
wolffd@0 1828 if ~LOG
wolffd@0 1829 index=get(getfield(get(gcf,'UserData'),'sets_h'),'Value');
wolffd@0 1830 end
wolffd@0 1831 data=get(pre_h,'UserData');
wolffd@0 1832 tmp_set.name=name{1};
wolffd@0 1833 data.sD_set(index).name=name{1};
wolffd@0 1834 if data.sData.INDEX == index
wolffd@0 1835 data.sData.name=name{1};
wolffd@0 1836 end
wolffd@0 1837 if ~LOG
wolffd@0 1838 data.LOG{length(data.LOG)+1}='% Rename a data set.';
wolffd@0 1839 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''rename'',''set ',...
wolffd@0 1840 name{1},' ',...
wolffd@0 1841 num2str(index),...
wolffd@0 1842 ''');');
wolffd@0 1843 end
wolffd@0 1844
wolffd@0 1845 set(pre_h,'UserData',data);
wolffd@0 1846 sD_names;
wolffd@0 1847 string=get(data.sD_set_h,'String');
wolffd@0 1848 string{index}=cat(2,sprintf('#%d: ',index),name{1});
wolffd@0 1849 set(data.sD_set_h,'String',string);
wolffd@0 1850 string=get(data.sD_name_h,'String');
wolffd@0 1851 string{1}=cat(2,'Name: ',name{1});
wolffd@0 1852 if index==data.sData.INDEX
wolffd@0 1853 set(data.sD_name_h,'String',string);
wolffd@0 1854 end
wolffd@0 1855 else
wolffd@0 1856 sD_stats;
wolffd@0 1857 end
wolffd@0 1858 case 'comp'
wolffd@0 1859 if ~LOG
wolffd@0 1860 names=get(new_c_name_h,'String');
wolffd@0 1861 index=get(getfield(get(gcf,'UserData'),'sets_h'),'Value');
wolffd@0 1862 else
wolffd@0 1863 names=eval(arg2);
wolffd@0 1864 end
wolffd@0 1865 if check_cell_names(names)
wolffd@0 1866 data=get(pre_h,'UserData');
wolffd@0 1867 sData=data.sD_set(index);
wolffd@0 1868 if length(sData.comp_names)==length(names)
wolffd@0 1869 data.sD_set(index).comp_names=names;
wolffd@0 1870 if index == data.sData.INDEX
wolffd@0 1871 for i=1:length(names)
wolffd@0 1872 names{i}=cat(2,sprintf('#%d: ',i),names{i});
wolffd@0 1873 end
wolffd@0 1874 set(data.comp_names_h,'String',names);
wolffd@0 1875 set(data.sel_comp_h,'String',names);
wolffd@0 1876 end
wolffd@0 1877 if ~LOG
wolffd@0 1878 data.LOG{length(data.LOG)+1}='% Rename components.';
wolffd@0 1879 str='preprocess(''rename'',''comp {';
wolffd@0 1880 for i=1:length(names)-1
wolffd@0 1881 str=cat(2,str,'''''',names{i},''''',');
wolffd@0 1882 end
wolffd@0 1883 str=cat(2,str,'''''',names{length(names)},'''''} ',...
wolffd@0 1884 num2str(index),''');');
wolffd@0 1885 data.LOG{length(data.LOG)+1}=str;
wolffd@0 1886 else
wolffd@0 1887 set(new_c_name_h,'String',names);
wolffd@0 1888 end
wolffd@0 1889 set(pre_h,'UserData',data);
wolffd@0 1890 else
wolffd@0 1891 errordlg('There are less components in data.');
wolffd@0 1892 sD_stats;
wolffd@0 1893 return;
wolffd@0 1894 end
wolffd@0 1895 else
wolffd@0 1896 sD_stats;
wolffd@0 1897 end
wolffd@0 1898 end
wolffd@0 1899
wolffd@0 1900 %%% Subfunction: check_cell_names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1901
wolffd@0 1902 function bool=check_cell_names(names)
wolffd@0 1903
wolffd@0 1904 bool = 1;
wolffd@0 1905
wolffd@0 1906 if isempty(names)
wolffd@0 1907 bool= 0;
wolffd@0 1908 return;
wolffd@0 1909 end
wolffd@0 1910 for i=1:length(names)
wolffd@0 1911 if isempty(names{i}) | isspace(names{i})
wolffd@0 1912 bool = 0;
wolffd@0 1913 return;
wolffd@0 1914 end
wolffd@0 1915 end
wolffd@0 1916
wolffd@0 1917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1918
wolffd@0 1919 %%% Subfunction: isvalid_var_name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1920
wolffd@0 1921 function bool=isvalid_var_name(name)
wolffd@0 1922
wolffd@0 1923 bool=1;
wolffd@0 1924
wolffd@0 1925 tmp=name{1};
wolffd@0 1926 if ~((tmp(1)>='a' & tmp(1)<='z') | (tmp(1)>='A' & tmp(1)<='Z'))
wolffd@0 1927 errordlg('Invalid name.');
wolffd@0 1928 bool=0;
wolffd@0 1929 return;
wolffd@0 1930 end
wolffd@0 1931 for j=1:length(tmp)
wolffd@0 1932 if ~((tmp(j)>='a' & tmp(j)<='z') | ...
wolffd@0 1933 (tmp(j)>='A' & tmp(j)<='Z') | ...
wolffd@0 1934 (j>1 & tmp(j) == '_') | ...
wolffd@0 1935 (tmp(j)>='0' & tmp(j) <= '9')) | tmp(j) == '.'
wolffd@0 1936 errordlg('Invalid name.');
wolffd@0 1937 bool=0;
wolffd@0 1938 return;
wolffd@0 1939 end
wolffd@0 1940 if j == length(tmp) & tmp(j) == '_'
wolffd@0 1941 errordlg('Invalid name.');
wolffd@0 1942 bool=0;
wolffd@0 1943 return;
wolffd@0 1944 end
wolffd@0 1945 end
wolffd@0 1946
wolffd@0 1947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1949
wolffd@0 1950 %%% Subfunction: copy_delete %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 1951
wolffd@0 1952 function copy_delete(arg)
wolffd@0 1953
wolffd@0 1954 i=1;
wolffd@0 1955 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 1956 i=i+1;
wolffd@0 1957 end
wolffd@0 1958
wolffd@0 1959 arg2=arg(i+1:length(arg));
wolffd@0 1960 arg=arg(1:i-1);
wolffd@0 1961
wolffd@0 1962 if ~isempty(arg2)
wolffd@0 1963 index=str2num(arg2);
wolffd@0 1964 LOG=1;
wolffd@0 1965 else
wolffd@0 1966 LOG=0;
wolffd@0 1967 end
wolffd@0 1968
wolffd@0 1969 sets_h=getfield(get(gcf,'UserData'),'sets_h');
wolffd@0 1970 if ~LOG
wolffd@0 1971 index=get(sets_h,'Value');
wolffd@0 1972 end
wolffd@0 1973 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 1974
wolffd@0 1975 if isempty(pre_h)
wolffd@0 1976 errordlg('''Preprocess'' -figure does not exist. Terminating program.');
wolffd@0 1977 close_preprocess;
wolffd@0 1978 return;
wolffd@0 1979 end
wolffd@0 1980
wolffd@0 1981 switch arg
wolffd@0 1982 case 'copy'
wolffd@0 1983 data=get(pre_h,'UserData');
wolffd@0 1984 data.sD_set(length(data.sD_set)+1)=data.sD_set(index);
wolffd@0 1985 if ~LOG
wolffd@0 1986 data.LOG{length(data.LOG)+1}='% Copy a data set.';
wolffd@0 1987 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''copy_delete'',''',...
wolffd@0 1988 'copy ',num2str(index),''');');
wolffd@0 1989 end
wolffd@0 1990 set(pre_h,'UserData',data);
wolffd@0 1991 sD_names;
wolffd@0 1992 old=gcf;
wolffd@0 1993 set(0,'CurrentFigure',pre_h);
wolffd@0 1994 set_sD_stats;
wolffd@0 1995 set(0,'CurrentFigure',old);
wolffd@0 1996 case 'delete'
wolffd@0 1997 if length(get(sets_h,'String')) == 1
wolffd@0 1998 msgbox('No data left. Closing program...')
wolffd@0 1999 close_preprocess;
wolffd@0 2000 return;
wolffd@0 2001 end
wolffd@0 2002 data=get(pre_h,'UserData');
wolffd@0 2003 if ~isempty(data.undo) & any(strcmp('index',fieldnames(data.undo)))
wolffd@0 2004 if data.undo.index > index
wolffd@0 2005 data.undo.index = data.undo.index-1;
wolffd@0 2006 elseif data.undo.index==index;
wolffd@0 2007 data.undo=[];
wolffd@0 2008 end
wolffd@0 2009 end
wolffd@0 2010 set1=data.sD_set(1:index-1);
wolffd@0 2011 set2=data.sD_set(index+1:length(data.sD_set));
wolffd@0 2012
wolffd@0 2013 if ~isempty(set1)
wolffd@0 2014 data.sD_set=[set1 set2];
wolffd@0 2015 else
wolffd@0 2016 data.sD_set=set2;
wolffd@0 2017 end
wolffd@0 2018 if ~LOG
wolffd@0 2019 data.LOG{length(data.LOG)+1}='% Delete a data set.';
wolffd@0 2020 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''copy_delete'',''',...
wolffd@0 2021 'delete ',num2str(index),''');');
wolffd@0 2022 end
wolffd@0 2023 set(pre_h,'UserData',data);
wolffd@0 2024
wolffd@0 2025 set(sets_h,'Value',1);
wolffd@0 2026 sD_names;
wolffd@0 2027 sD_stats;
wolffd@0 2028 old = gcf;
wolffd@0 2029 set(0,'CurrentFigure',pre_h);
wolffd@0 2030
wolffd@0 2031 for i=1:length(data.sD_set)
wolffd@0 2032 string{i}=cat(2,sprintf('#%d: ',i),data.sD_set(i).name);
wolffd@0 2033 end
wolffd@0 2034
wolffd@0 2035 set(data.sD_set_h,'String',string);
wolffd@0 2036 data.sData=data.sD_set(get(data.sD_set_h,'Value'));
wolffd@0 2037 data.sData.MODIFIED=0;
wolffd@0 2038 data.sData.INDEX=1;
wolffd@0 2039 set(gcf,'UserData',data);
wolffd@0 2040 write_sD_stats;
wolffd@0 2041
wolffd@0 2042 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 2043 if sData.INDEX > index
wolffd@0 2044 value=get(getfield(get(gcf,'UserData'),'sD_set_h'),'Value');
wolffd@0 2045 set(getfield(get(gcf,'UserData'),'sD_set_h'),'Value',value-1);
wolffd@0 2046 sData.INDEX = sData.INDEX -1;
wolffd@0 2047 elseif sData.INDEX == index
wolffd@0 2048 set(getfield(get(gcf,'UserData'),'sD_set_h'),'Value',1);
wolffd@0 2049 end
wolffd@0 2050
wolffd@0 2051 sel_sD;
wolffd@0 2052 set(0,'CurrentFigure',old);
wolffd@0 2053 end
wolffd@0 2054
wolffd@0 2055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2056
wolffd@0 2057 function clipping(varargin)
wolffd@0 2058
wolffd@0 2059 if nargin ~= 1
wolffd@0 2060 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 2061 preh_udata=get(pre_h,'UserData');
wolffd@0 2062 preh_udata.LOG{length(preh_udata.LOG)+1}=...
wolffd@0 2063 '% Starting the ''Clipping'' -window...';
wolffd@0 2064 preh_udata.LOG{length(preh_udata.LOG)+1}='preprocess(''clipping'',''foo'');';
wolffd@0 2065 set(pre_h,'UserData',preh_udata);
wolffd@0 2066 end
wolffd@0 2067
wolffd@0 2068 clip_h=findobj(get(0,'Children'),'Tag','Clipping');
wolffd@0 2069
wolffd@0 2070 if ~isempty(clip_h)
wolffd@0 2071 figure(clip_h);
wolffd@0 2072 return;
wolffd@0 2073 end
wolffd@0 2074
wolffd@0 2075 h0 = figure('Color',[0.8 0.8 0.8], ...
wolffd@0 2076 'PaperPosition',[18 180 575 432], ...
wolffd@0 2077 'PaperUnits','points', ...
wolffd@0 2078 'Position',[718 389 300 249], ...
wolffd@0 2079 'Tag','Clipping');
wolffd@0 2080
wolffd@0 2081 h1 = uicontrol('Parent',h0, ...
wolffd@0 2082 'Units','normalized', ...
wolffd@0 2083 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 2084 'ListboxTop',0, ...
wolffd@0 2085 'Position',[0.03 0.03614457831325301 0.4666666666666667 0.9236947791164658], ...
wolffd@0 2086 'Style','frame', ...
wolffd@0 2087 'Tag','Frame1');
wolffd@0 2088
wolffd@0 2089 h1 = uicontrol('Parent',h0, ...
wolffd@0 2090 'Units','normalized', ...
wolffd@0 2091 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2092 'ListboxTop',0, ...
wolffd@0 2093 'Position',[0.05333333333333334 0.5983935742971887 0.42 0.3333333333333333], ...
wolffd@0 2094 'Style','frame', ...
wolffd@0 2095 'Tag','Frame2');
wolffd@0 2096
wolffd@0 2097 h1 = uicontrol('Parent',h0, ...
wolffd@0 2098 'Units','normalized', ...
wolffd@0 2099 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2100 'ListboxTop',0, ...
wolffd@0 2101 'Style','frame', ...
wolffd@0 2102 'Position',[0.05333333333333334 0.33 0.42 0.24], ...
wolffd@0 2103 'Tag','Frame3');
wolffd@0 2104
wolffd@0 2105 h1 = uicontrol('Parent',h0, ...
wolffd@0 2106 'Units','normalized', ...
wolffd@0 2107 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2108 'ListboxTop',0, ...
wolffd@0 2109 'Style','frame', ...
wolffd@0 2110 'Position',[0.05333333333333334 0.06 0.42 0.24],...
wolffd@0 2111 'Tag','Frame4');
wolffd@0 2112
wolffd@0 2113 h1 = uicontrol('Parent',h0, ...
wolffd@0 2114 'Units','normalized', ...
wolffd@0 2115 'ListboxTop',0, ...
wolffd@0 2116 'Position',[0.5133333333333334 0.6385542168674698 0.4666666666666667 0.321285140562249], ...
wolffd@0 2117 'Style','frame', ...
wolffd@0 2118 'Tag','Frame5');
wolffd@0 2119
wolffd@0 2120 h1 = uicontrol('Parent',h0, ...
wolffd@0 2121 'Units','normalized', ...
wolffd@0 2122 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2123 'ListboxTop',0, ...
wolffd@0 2124 'Position',[0.5366666666666667 0.6666666666666666 0.42 0.2650602409638554], ...
wolffd@0 2125 'Style','frame', ...
wolffd@0 2126 'Tag','Frame6');
wolffd@0 2127
wolffd@0 2128 h1 = uicontrol('Parent',h0, ...
wolffd@0 2129 'Units','normalized', ...
wolffd@0 2130 'BackgroundColor',[1 1 1], ...
wolffd@0 2131 'ListboxTop',0, ...
wolffd@0 2132 'Position',[0.31 0.823293172690763 0.15 0.09638554216867469], ...
wolffd@0 2133 'Style','edit', ...
wolffd@0 2134 'Tag','EditText1');
wolffd@0 2135
wolffd@0 2136 data.big_val_h = h1;
wolffd@0 2137
wolffd@0 2138 h1 = uicontrol('Parent',h0, ...
wolffd@0 2139 'Units','normalized', ...
wolffd@0 2140 'BackgroundColor',[1 1 1], ...
wolffd@0 2141 'ListboxTop',0, ...
wolffd@0 2142 'Position',[0.31 0.7148594377510039 0.15 0.09638554216867469], ...
wolffd@0 2143 'Style','edit', ...
wolffd@0 2144 'Tag','EditText2');
wolffd@0 2145
wolffd@0 2146 data.small_val_h = h1;
wolffd@0 2147
wolffd@0 2148 h1 = uicontrol('Parent',h0, ...
wolffd@0 2149 'Units','normalized', ...
wolffd@0 2150 'BackgroundColor',[1 1 1], ...
wolffd@0 2151 'ListboxTop',0, ...
wolffd@0 2152 'Position',[0.31 0.606425702811245 0.15 0.09638554216867469], ...
wolffd@0 2153 'Style','edit', ...
wolffd@0 2154 'Tag','EditText3');
wolffd@0 2155
wolffd@0 2156 data.equal_val_h=h1;
wolffd@0 2157
wolffd@0 2158 h1 = uicontrol('Parent',h0, ...
wolffd@0 2159 'Units','normalized', ...
wolffd@0 2160 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2161 'FontSize',6, ...
wolffd@0 2162 'FontWeight','demi', ...
wolffd@0 2163 'HorizontalAlignment','left', ...
wolffd@0 2164 'ListboxTop',0, ...
wolffd@0 2165 'Position',[0.06000000000000001 0.8473895582329316 0.22 0.05622489959839357], ...
wolffd@0 2166 'String','Bigger than', ...
wolffd@0 2167 'Style','text', ...
wolffd@0 2168 'Tag','StaticText1');
wolffd@0 2169 h1 = uicontrol('Parent',h0, ...
wolffd@0 2170 'Units','normalized', ...
wolffd@0 2171 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2172 'FontSize',6, ...
wolffd@0 2173 'FontWeight','demi', ...
wolffd@0 2174 'HorizontalAlignment','left', ...
wolffd@0 2175 'ListboxTop',0, ...
wolffd@0 2176 'Position',[0.06000000000000001 0.7389558232931727 0.24 0.04819277108433735], ...
wolffd@0 2177 'String','Smaller than', ...
wolffd@0 2178 'Style','text', ...
wolffd@0 2179 'Tag','StaticText2');
wolffd@0 2180 h1 = uicontrol('Parent',h0, ...
wolffd@0 2181 'Units','normalized', ...
wolffd@0 2182 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2183 'FontSize',6, ...
wolffd@0 2184 'FontWeight','demi', ...
wolffd@0 2185 'HorizontalAlignment','left', ...
wolffd@0 2186 'ListboxTop',0, ...
wolffd@0 2187 'Position',[0.06000000000000001 0.610441767068273 0.22 0.07228915662650602], ...
wolffd@0 2188 'String','Equal to', ...
wolffd@0 2189 'Style','text', ...
wolffd@0 2190 'Tag','StaticText3');
wolffd@0 2191
wolffd@0 2192 h1 = uicontrol('Parent',h0, ...
wolffd@0 2193 'Units','normalized', ...
wolffd@0 2194 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2195 'ListboxTop',0, ...
wolffd@0 2196 'Position',[0.07000000000000001 0.465863453815261 0.06333333333333334 0.07228915662650602], ...
wolffd@0 2197 'Style','radiobutton', ...
wolffd@0 2198 'Value',1,...
wolffd@0 2199 'Tag','Radiobutton1');
wolffd@0 2200
wolffd@0 2201 data.and_button_h=h1;
wolffd@0 2202
wolffd@0 2203 h1 = uicontrol('Parent',h0, ...
wolffd@0 2204 'Units','normalized', ...
wolffd@0 2205 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2206 'ListboxTop',0, ...
wolffd@0 2207 'Position',[0.07000000000000001 0.3734939759036144 0.06333333333333334 0.07228915662650602], ...
wolffd@0 2208 'Style','radiobutton', ...
wolffd@0 2209 'Tag','Radiobutton2');
wolffd@0 2210
wolffd@0 2211 data.or_button_h=h1;
wolffd@0 2212
wolffd@0 2213 h1 = uicontrol('Parent',h0, ...
wolffd@0 2214 'Units','normalized', ...
wolffd@0 2215 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2216 'FontSize',6, ...
wolffd@0 2217 'FontWeight','demi', ...
wolffd@0 2218 'HorizontalAlignment','left', ...
wolffd@0 2219 'Position',[0.1466666666666667 0.45 0.2333333333333333 0.07228915662650602], ...
wolffd@0 2220 'String','AND', ...
wolffd@0 2221 'Style','text', ...
wolffd@0 2222 'Tag','StaticText4');
wolffd@0 2223
wolffd@0 2224 h1 = uicontrol('Parent',h0, ...
wolffd@0 2225 'Units','normalized', ...
wolffd@0 2226 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2227 'FontSize',6, ...
wolffd@0 2228 'FontWeight','demi', ...
wolffd@0 2229 'HorizontalAlignment','left', ...
wolffd@0 2230 'ListboxTop',0, ...
wolffd@0 2231 'String','OR', ...
wolffd@0 2232 'Position',[0.1466666666666667 0.35 0.2333333333333333 0.07228915662650602], ...
wolffd@0 2233 'Style','text', ...
wolffd@0 2234 'Tag','StaticText5');
wolffd@0 2235
wolffd@0 2236 h1 = uicontrol('Parent',h0, ...
wolffd@0 2237 'Units','normalized', ...
wolffd@0 2238 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2239 'ListboxTop',0, ...
wolffd@0 2240 'Position',[0.07000000000000001 0.1967871485943775 0.06333333333333334 0.07228915662650602], ...
wolffd@0 2241 'Style','radiobutton', ...
wolffd@0 2242 'Value',1,...
wolffd@0 2243 'Tag','Radiobutton3');
wolffd@0 2244
wolffd@0 2245 data.all_button_h=h1;
wolffd@0 2246
wolffd@0 2247 h1 = uicontrol('Parent',h0, ...
wolffd@0 2248 'Units','normalized', ...
wolffd@0 2249 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2250 'ListboxTop',0, ...
wolffd@0 2251 'Position',[0.07000000000000001 0.09236947791164658 0.06333333333333334 0.07228915662650602], ...
wolffd@0 2252 'Style','radiobutton', ...
wolffd@0 2253 'Tag','Radiobutton4');
wolffd@0 2254
wolffd@0 2255 data.sel_vects_button_h=h1;
wolffd@0 2256
wolffd@0 2257 h1 = uicontrol('Parent',h0, ...
wolffd@0 2258 'Units','normalized', ...
wolffd@0 2259 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2260 'FontSize',6, ...
wolffd@0 2261 'FontWeight','demi', ...
wolffd@0 2262 'HorizontalAlignment','left', ...
wolffd@0 2263 'ListboxTop',0, ...
wolffd@0 2264 'Position',[0.1466666666666667 0.1927710843373494 0.2333333333333333 0.07228915662650602], ...
wolffd@0 2265 'String','All vectors', ...
wolffd@0 2266 'Style','text', ...
wolffd@0 2267 'Tag','StaticText6');
wolffd@0 2268 h1 = uicontrol('Parent',h0, ...
wolffd@0 2269 'Units','normalized', ...
wolffd@0 2270 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2271 'FontSize',6, ...
wolffd@0 2272 'FontWeight','demi', ...
wolffd@0 2273 'HorizontalAlignment','left', ...
wolffd@0 2274 'ListboxTop',0, ...
wolffd@0 2275 'Position',[0.1466666666666667 0.09638554216867469 0.3133333333333334 0.05622489959839357], ...
wolffd@0 2276 'String','Among selected', ...
wolffd@0 2277 'Style','text', ...
wolffd@0 2278 'Tag','StaticText7');
wolffd@0 2279 h1 = uicontrol('Parent',h0, ...
wolffd@0 2280 'Units','normalized', ...
wolffd@0 2281 'BackgroundColor',[1 1 1], ...
wolffd@0 2282 'ListboxTop',0, ...
wolffd@0 2283 'Position',[0.7866666666666667 0.823293172690763 0.1366666666666667 0.09236947791164658], ...
wolffd@0 2284 'Style','edit', ...
wolffd@0 2285 'Tag','EditText4');
wolffd@0 2286
wolffd@0 2287 data.replace_val_h=h1;
wolffd@0 2288
wolffd@0 2289 h1 = uicontrol('Parent',h0, ...
wolffd@0 2290 'Units','normalized', ...
wolffd@0 2291 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2292 'FontSize',6, ...
wolffd@0 2293 'FontWeight','demi', ...
wolffd@0 2294 'HorizontalAlignment','left', ...
wolffd@0 2295 'ListboxTop',0, ...
wolffd@0 2296 'Position',[0.5633333333333334 0.8273092369477911 0.2066666666666667 0.07630522088353413], ...
wolffd@0 2297 'String','Replace', ...
wolffd@0 2298 'Style','text', ...
wolffd@0 2299 'Tag','StaticText8');
wolffd@0 2300 h1 = uicontrol('Parent',h0, ...
wolffd@0 2301 'Units','normalized', ...
wolffd@0 2302 'FontWeight','demi', ...
wolffd@0 2303 'ListboxTop',0, ...
wolffd@0 2304 'Position',[0.5700000000000001 0.6827309236947791 0.3566666666666667 0.08032128514056225], ...
wolffd@0 2305 'String','Replace', ...
wolffd@0 2306 'Tag','Pushbutton1');
wolffd@0 2307
wolffd@0 2308 data.OK_button_h=h1;
wolffd@0 2309
wolffd@0 2310 h1 = uicontrol('Parent',h0, ...
wolffd@0 2311 'Units','normalized', ...
wolffd@0 2312 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 2313 'Callback','preprocess close_c',...
wolffd@0 2314 'FontWeight','demi', ...
wolffd@0 2315 'ListboxTop',0, ...
wolffd@0 2316 'Position',[0.6633333333333333 0.07228915662650602 0.2833333333333333 0.09638554216867469], ...
wolffd@0 2317 'String','Close', ...
wolffd@0 2318 'Tag','Pushbutton2');
wolffd@0 2319
wolffd@0 2320
wolffd@0 2321 data.state.and=1;
wolffd@0 2322 data.state.all=1;
wolffd@0 2323 data.state.big=[];
wolffd@0 2324 data.state.small=[];
wolffd@0 2325 data.state.equal=[];
wolffd@0 2326 data.state.replace=[];
wolffd@0 2327
wolffd@0 2328 set(data.or_button_h,'Callback','preprocess and_or_cb or');
wolffd@0 2329 set(data.and_button_h,'Callback','preprocess and_or_cb and');
wolffd@0 2330 set(data.and_button_h,'Value',1);
wolffd@0 2331 set(data.all_button_h,'Callback','preprocess all_sel_cb all');
wolffd@0 2332 set(data.sel_vects_button_h,'Callback','preprocess all_sel_cb sel');
wolffd@0 2333 set(data.big_val_h,'Callback','preprocess set_state_vals big');
wolffd@0 2334 set(data.small_val_h,'Callback','preprocess set_state_vals small');
wolffd@0 2335 set(data.equal_val_h,'Callback','preprocess set_state_vals equal');
wolffd@0 2336 set(data.replace_val_h,'Callback','preprocess set_state_vals replace');
wolffd@0 2337 set(data.OK_button_h,'Callback','preprocess clip_data clip');
wolffd@0 2338 set(h0,'UserData',data);
wolffd@0 2339
wolffd@0 2340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2341
wolffd@0 2342 function select(varargin)
wolffd@0 2343
wolffd@0 2344 if nargin ~= 1
wolffd@0 2345 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 2346 preh_udata=get(pre_h,'UserData');
wolffd@0 2347 preh_udata.LOG{length(preh_udata.LOG)+1}=...
wolffd@0 2348 '% Starting the ''Select'' -window...';
wolffd@0 2349 preh_udata.LOG{length(preh_udata.LOG)+1}='preprocess(''select'',''foo'');';
wolffd@0 2350 set(pre_h,'UserData',preh_udata);
wolffd@0 2351 end
wolffd@0 2352
wolffd@0 2353 sel_h=findobj(get(0,'Children'),'Tag','Select');
wolffd@0 2354
wolffd@0 2355 if ~isempty(sel_h)
wolffd@0 2356 figure(sel_h);
wolffd@0 2357 return;
wolffd@0 2358 end
wolffd@0 2359
wolffd@0 2360 h0 = figure('Color',[0.8 0.8 0.8], ...
wolffd@0 2361 'PaperPosition',[18 180 576 432], ...
wolffd@0 2362 'PaperUnits','points', ...
wolffd@0 2363 'Position',[750 431 168 365], ...
wolffd@0 2364 'Tag','Select');
wolffd@0 2365 h1 = uicontrol('Parent',h0, ...
wolffd@0 2366 'Units','normalized', ...
wolffd@0 2367 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 2368 'ListboxTop',0, ...
wolffd@0 2369 'Position',[0.05357142857142857 0.2712328767123288 0.8333333333333333 0.6301369863013698], ...
wolffd@0 2370 'Style','frame', ...
wolffd@0 2371 'Tag','Frame1');
wolffd@0 2372
wolffd@0 2373 h1 = uicontrol('Parent',h0, ...
wolffd@0 2374 'Units','normalized', ...
wolffd@0 2375 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 2376 'ListboxTop',0, ...
wolffd@0 2377 'Position',[0.05357142857142857 0.1041095890410959 0.8333333333333333 0.1397260273972603], ...
wolffd@0 2378 'Style','frame', ...
wolffd@0 2379 'Tag','Frame2');
wolffd@0 2380
wolffd@0 2381 h1 = uicontrol('Parent',h0,...
wolffd@0 2382 'Units','normalized', ...
wolffd@0 2383 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2384 'ListboxTop',0, ...
wolffd@0 2385 'Position',[0.09523809523809523 0.6547945205479452 0.75 0.2273972602739726], ...
wolffd@0 2386 'Style','frame', ...
wolffd@0 2387 'Tag','Frame3');
wolffd@0 2388
wolffd@0 2389 h1 = uicontrol('Parent',h0, ...
wolffd@0 2390 'Units','normalized', ...
wolffd@0 2391 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2392 'ListboxTop',0, ...
wolffd@0 2393 'Position',[0.09523809523809523 0.4794520547945206 0.75 0.1506849315068493], ...
wolffd@0 2394 'Style','frame', ...
wolffd@0 2395 'Tag','Frame4');
wolffd@0 2396
wolffd@0 2397 h1 = uicontrol('Parent',h0, ...
wolffd@0 2398 'Units','normalized', ...
wolffd@0 2399 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2400 'ListboxTop',0, ...
wolffd@0 2401 'Position',[0.09523809523809523 0.2986301369863014 0.75 0.1506849315068493], ...
wolffd@0 2402 'Style','frame', ...
wolffd@0 2403 'Tag','Frame5');
wolffd@0 2404
wolffd@0 2405 h1 = uicontrol('Parent',h0, ...
wolffd@0 2406 'Units','normalized', ...
wolffd@0 2407 'BackgroundColor',[1 1 1], ...
wolffd@0 2408 'ListboxTop',0, ...
wolffd@0 2409 'Position',[0.5535714285714285 0.8082191780821918 0.2678571428571429 0.06575342465753425], ...
wolffd@0 2410 'Style','edit', ...
wolffd@0 2411 'Tag','EditText1');
wolffd@0 2412
wolffd@0 2413 data.big_val_h=h1;
wolffd@0 2414
wolffd@0 2415 h1 = uicontrol('Parent',h0, ...
wolffd@0 2416 'Units','normalized', ...
wolffd@0 2417 'BackgroundColor',[1 1 1], ...
wolffd@0 2418 'ListboxTop',0, ...
wolffd@0 2419 'Position',[0.5535714285714285 0.7342465753424657 0.2678571428571429 0.06575342465753425], ...
wolffd@0 2420 'Style','edit', ...
wolffd@0 2421 'Tag','EditText2');
wolffd@0 2422
wolffd@0 2423 data.small_val_h = h1;
wolffd@0 2424
wolffd@0 2425 h1 = uicontrol('Parent',h0, ...
wolffd@0 2426 'Units','normalized', ...
wolffd@0 2427 'BackgroundColor',[1 1 1], ...
wolffd@0 2428 'ListboxTop',0, ...
wolffd@0 2429 'Position',[0.5535714285714285 0.6602739726027397 0.2678571428571429 0.06575342465753425], ...
wolffd@0 2430 'Style','edit', ...
wolffd@0 2431 'Tag','EditText3');
wolffd@0 2432
wolffd@0 2433 data.equal_val_h=h1;
wolffd@0 2434
wolffd@0 2435 h1 = uicontrol('Parent',h0, ...
wolffd@0 2436 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2437 'Units','normalized', ...
wolffd@0 2438 'FontWeight','demi', ...
wolffd@0 2439 'FontSize',8,...
wolffd@0 2440 'HorizontalAlignment','left', ...
wolffd@0 2441 'ListboxTop',0, ...
wolffd@0 2442 'Position',[0.1071 0.8247 0.3929 0.0384], ...
wolffd@0 2443 'String','Bigger than', ...
wolffd@0 2444 'Style','text', ...
wolffd@0 2445 'Tag','StaticText1');
wolffd@0 2446
wolffd@0 2447 h1 = uicontrol('Parent',h0, ...
wolffd@0 2448 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2449 'Units','normalized', ...
wolffd@0 2450 'FontWeight','demi', ...
wolffd@0 2451 'FontSize',8,...
wolffd@0 2452 'HorizontalAlignment','left', ...
wolffd@0 2453 'ListboxTop',0, ...
wolffd@0 2454 'Position',[0.1071 0.7507 0.4286 0.0329], ...
wolffd@0 2455 'String','Smaller than', ...
wolffd@0 2456 'Style','text', ...
wolffd@0 2457 'Tag','StaticText2');
wolffd@0 2458
wolffd@0 2459 h1 = uicontrol('Parent',h0, ...
wolffd@0 2460 'Units','normalized', ...
wolffd@0 2461 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2462 'FontWeight','demi', ...
wolffd@0 2463 'FontSize',8,...
wolffd@0 2464 'HorizontalAlignment','left', ...
wolffd@0 2465 'ListboxTop',0, ...
wolffd@0 2466 'Position',[0.1071 0.6630 0.3929 0.0493], ...
wolffd@0 2467 'String','Equal to', ...
wolffd@0 2468 'Style','text', ...
wolffd@0 2469 'Tag','StaticText3');
wolffd@0 2470
wolffd@0 2471 h1 = uicontrol('Parent',h0, ...
wolffd@0 2472 'Units','normalized', ...
wolffd@0 2473 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2474 'ListboxTop',0, ...
wolffd@0 2475 'Position',[0.125 0.5643835616438356 0.1130952380952381 0.04931506849315068], ...
wolffd@0 2476 'Style','radiobutton', ...
wolffd@0 2477 'Tag','Radiobutton1');
wolffd@0 2478
wolffd@0 2479 data.and_button_h = h1;
wolffd@0 2480
wolffd@0 2481 h1 = uicontrol('Parent',h0, ...
wolffd@0 2482 'Units','normalized', ...
wolffd@0 2483 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2484 'ListboxTop',0, ...
wolffd@0 2485 'Position',[0.125 0.5013698630136987 0.1130952380952381 0.04931506849315068], ...
wolffd@0 2486 'Style','radiobutton', ...
wolffd@0 2487 'Tag','Radiobutton2');
wolffd@0 2488
wolffd@0 2489 data.or_button_h = h1;
wolffd@0 2490
wolffd@0 2491 h1 = uicontrol('Parent',h0, ...
wolffd@0 2492 'Units','normalized', ...
wolffd@0 2493 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2494 'FontWeight','demi', ...
wolffd@0 2495 'FontSize',8,...
wolffd@0 2496 'HorizontalAlignment','left', ...
wolffd@0 2497 'ListboxTop',0, ...
wolffd@0 2498 'Position',[0.2619047619047619 0.5561643835616439 0.3809523809523809 0.05205479452054795], ...
wolffd@0 2499 'String','AND', ...
wolffd@0 2500 'Style','text', ...
wolffd@0 2501 'Tag','StaticText4');
wolffd@0 2502
wolffd@0 2503 h1 = uicontrol('Parent',h0, ...
wolffd@0 2504 'Units','normalized', ...
wolffd@0 2505 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2506 'FontWeight','demi', ...
wolffd@0 2507 'FontSize',8,...
wolffd@0 2508 'HorizontalAlignment','left', ...
wolffd@0 2509 'ListboxTop',0, ...
wolffd@0 2510 'Position',[0.2619047619047619 0.4986301369863014 0.3809523809523809 0.04657534246575343], ...
wolffd@0 2511 'String','OR', ...
wolffd@0 2512 'Style','text', ...
wolffd@0 2513 'Tag','StaticText5');
wolffd@0 2514
wolffd@0 2515 h1 = uicontrol('Parent',h0, ...
wolffd@0 2516 'Units','normalized', ...
wolffd@0 2517 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2518 'ListboxTop',0, ...
wolffd@0 2519 'Position',[0.125 0.3808219178082192 0.1130952380952381 0.04931506849315068], ...
wolffd@0 2520 'Style','radiobutton', ...
wolffd@0 2521 'Tag','Radiobutton3');
wolffd@0 2522
wolffd@0 2523 data.all_button_h = h1;
wolffd@0 2524
wolffd@0 2525 h1 = uicontrol('Parent',h0, ...
wolffd@0 2526 'Units','normalized', ...
wolffd@0 2527 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2528 'ListboxTop',0, ...
wolffd@0 2529 'Position',[0.125 0.3095890410958904 0.1130952380952381 0.04931506849315068], ...
wolffd@0 2530 'Style','radiobutton', ...
wolffd@0 2531 'Tag','Radiobutton4');
wolffd@0 2532
wolffd@0 2533 data.sel_vects_button_h = h1;
wolffd@0 2534
wolffd@0 2535 h1 = uicontrol('Parent',h0, ...
wolffd@0 2536 'Units','normalized', ...
wolffd@0 2537 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2538 'FontWeight','demi', ...
wolffd@0 2539 'FontSize',8,...
wolffd@0 2540 'HorizontalAlignment','left', ...
wolffd@0 2541 'ListboxTop',0, ...
wolffd@0 2542 'Position',[0.2619047619047619 0.3780821917808219 0.4166666666666666 0.04931506849315068], ...
wolffd@0 2543 'String','All vectors', ...
wolffd@0 2544 'Style','text', ...
wolffd@0 2545 'Tag','StaticText6');
wolffd@0 2546
wolffd@0 2547 h1 = uicontrol('Parent',h0, ...
wolffd@0 2548 'Units','normalized', ...
wolffd@0 2549 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2550 'FontWeight','demi', ...
wolffd@0 2551 'FontSize',8,...
wolffd@0 2552 'HorizontalAlignment','left', ...
wolffd@0 2553 'ListboxTop',0, ...
wolffd@0 2554 'Position',[0.2619047619047619 0.3123287671232877 0.5595238095238095 0.03835616438356165], ...
wolffd@0 2555 'String','Among selected', ...
wolffd@0 2556 'Style','text', ...
wolffd@0 2557 'Tag','StaticText7');
wolffd@0 2558
wolffd@0 2559 h1 = uicontrol('Parent',h0, ...
wolffd@0 2560 'Units','normalized', ...
wolffd@0 2561 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2562 'ListboxTop',0, ...
wolffd@0 2563 'Position',[0.0952 0.1178 0.7500 0.1068], ...
wolffd@0 2564 'Style','frame', ...
wolffd@0 2565 'Tag','Frame6');
wolffd@0 2566
wolffd@0 2567 h1 = uicontrol('Parent',h0, ...
wolffd@0 2568 'Units','normalized', ...
wolffd@0 2569 'BackgroundColor',[1 1 1], ...
wolffd@0 2570 'ListboxTop',0, ...
wolffd@0 2571 'Position',[0.5298 0.1342 0.2738 0.0712], ...
wolffd@0 2572 'Style','edit', ...
wolffd@0 2573 'Tag','EditText4');
wolffd@0 2574
wolffd@0 2575 data.replace_val_h = h1;
wolffd@0 2576
wolffd@0 2577 h1 = uicontrol('Parent',h0, ...
wolffd@0 2578 'Units','normalized', ...
wolffd@0 2579 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 2580 'FontSize',8,...
wolffd@0 2581 'FontWeight','demi', ...
wolffd@0 2582 'HorizontalAlignment','left', ...
wolffd@0 2583 'ListboxTop',0, ...
wolffd@0 2584 'Position',[0.1369047619047619 0.136986301369863 0.3214285714285714 0.06027397260273973], ...
wolffd@0 2585 'String','Vectors', ...
wolffd@0 2586 'Style','text', ...
wolffd@0 2587 'Tag','StaticText8');
wolffd@0 2588
wolffd@0 2589 h1 = uicontrol('Parent',h0, ...
wolffd@0 2590 'Units','normalized', ...
wolffd@0 2591 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 2592 'FontWeight','demi', ...
wolffd@0 2593 'ListboxTop',0, ...
wolffd@0 2594 'Position',[0.05357142857142857 0.01917808219178082 0.3869047619047619 0.0684931506849315], ...
wolffd@0 2595 'String','OK', ...
wolffd@0 2596 'Tag','Pushbutton1');
wolffd@0 2597
wolffd@0 2598 data.OK_button_h = h1;
wolffd@0 2599
wolffd@0 2600 h1 = uicontrol('Parent',h0, ...
wolffd@0 2601 'Units','normalized', ...
wolffd@0 2602 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 2603 'Callback','preprocess close_s',...
wolffd@0 2604 'FontWeight','demi', ...
wolffd@0 2605 'ListboxTop',0, ...
wolffd@0 2606 'Position',[0.5 0.01917808219178082 0.3869047619047619 0.0684931506849315], ...
wolffd@0 2607 'String','Close', ...
wolffd@0 2608 'Tag','Pushbutton2');
wolffd@0 2609
wolffd@0 2610
wolffd@0 2611
wolffd@0 2612 data.state.and=1;
wolffd@0 2613 data.state.all=1;
wolffd@0 2614 data.state.big=[];
wolffd@0 2615 data.state.small=[];
wolffd@0 2616 data.state.equal=[];
wolffd@0 2617 data.state.replace=[];
wolffd@0 2618
wolffd@0 2619 set(data.or_button_h,'Callback','preprocess and_or_cb or');
wolffd@0 2620 set(data.and_button_h,'Callback','preprocess and_or_cb and');
wolffd@0 2621 set(data.and_button_h,'Value',1);
wolffd@0 2622 set(data.all_button_h,'Callback','preprocess all_sel_cb all');
wolffd@0 2623 set(data.sel_vects_button_h,'Callback','preprocess all_sel_cb sel');
wolffd@0 2624 set(data.big_val_h,'Callback','preprocess set_state_vals big');
wolffd@0 2625 set(data.small_val_h,'Callback','preprocess set_state_vals small');
wolffd@0 2626 set(data.equal_val_h,'Callback','preprocess set_state_vals equal');
wolffd@0 2627 set(data.replace_val_h,'Callback','preprocess set_state_vals replace');
wolffd@0 2628 set(data.OK_button_h,'Callback','preprocess clip_data sel');
wolffd@0 2629 set(h0,'UserData',data);
wolffd@0 2630
wolffd@0 2631
wolffd@0 2632
wolffd@0 2633 %%% Subfunction: and_or_cb %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2634
wolffd@0 2635 function and_or_cb(arg)
wolffd@0 2636
wolffd@0 2637 %AND_OR_CB A callback function. Checks that only one of the radiobox
wolffd@0 2638 % buttons 'AND' and 'OR' is pressed down.
wolffd@0 2639 %
wolffd@0 2640 %
wolffd@0 2641
wolffd@0 2642 and_button_h=getfield(get(gcf,'UserData'),'and_button_h');
wolffd@0 2643 or_button_h=getfield(get(gcf,'UserData'),'or_button_h');
wolffd@0 2644 data=get(gcf,'UserData');
wolffd@0 2645
wolffd@0 2646 switch arg
wolffd@0 2647 case 'or'
wolffd@0 2648 set(and_button_h,'Value',0);
wolffd@0 2649 set(or_button_h,'Value',1);
wolffd@0 2650 data.state.and=0;
wolffd@0 2651 case 'and'
wolffd@0 2652 set(or_button_h,'Value',0);
wolffd@0 2653 set(and_button_h,'Value',1);
wolffd@0 2654 data.state.and=1;
wolffd@0 2655 end
wolffd@0 2656
wolffd@0 2657 set(gcf,'UserData',data);
wolffd@0 2658
wolffd@0 2659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2660
wolffd@0 2661 %%% Subfunction: all_sel_cb %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2662
wolffd@0 2663 function all_sel_cb(arg)
wolffd@0 2664
wolffd@0 2665 all_button_h=getfield(get(gcf,'UserData'),'all_button_h');
wolffd@0 2666 sel_vects_button_h=getfield(get(gcf,'UserData'),'sel_vects_button_h');
wolffd@0 2667 data=get(gcf,'UserData');
wolffd@0 2668
wolffd@0 2669 switch arg
wolffd@0 2670 case 'all'
wolffd@0 2671 set(sel_vects_button_h,'Value',0);
wolffd@0 2672 set(all_button_h,'Value',1);
wolffd@0 2673 data.state.all=1;
wolffd@0 2674 case 'sel'
wolffd@0 2675 set(all_button_h,'Value',0);
wolffd@0 2676 set(sel_vects_button_h,'Value',1);
wolffd@0 2677 data.state.all=0;
wolffd@0 2678 end
wolffd@0 2679
wolffd@0 2680 set(gcf,'UserData',data);
wolffd@0 2681
wolffd@0 2682 %%% Subfunction: set_state_vals %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2683
wolffd@0 2684 function set_state_vals(arg)
wolffd@0 2685
wolffd@0 2686 %SET_STATE_VALS sets the values to the UserData's state-struct.
wolffd@0 2687 %
wolffd@0 2688 %
wolffd@0 2689
wolffd@0 2690
wolffd@0 2691 data=get(gcf,'UserData');
wolffd@0 2692
wolffd@0 2693 switch arg
wolffd@0 2694 case 'big'
wolffd@0 2695 big_val_h=getfield(get(gcf,'UserData'),'big_val_h');
wolffd@0 2696 val =str2num(get(big_val_h,'String'));
wolffd@0 2697 dims=size(val);
wolffd@0 2698 if dims(1) ~= 1 | dims(2) ~= 1
wolffd@0 2699 errordlg('Argument of the operation must be scalar.');
wolffd@0 2700 set(big_val_h,'String','');
wolffd@0 2701 return;
wolffd@0 2702 end
wolffd@0 2703 if isreal(val)
wolffd@0 2704 data.state.big=val;
wolffd@0 2705 else
wolffd@0 2706 errordlg('Limits of the operation must be real.');
wolffd@0 2707 set(big_val_h,'String','');
wolffd@0 2708 return;
wolffd@0 2709 end
wolffd@0 2710 case 'small'
wolffd@0 2711 small_val_h=getfield(get(gcf,'UserData'),'small_val_h');
wolffd@0 2712 val=str2num(get(small_val_h,'String'));
wolffd@0 2713 dims=size(val);
wolffd@0 2714 if dims(1) ~= 1 | dims(2) ~= 1
wolffd@0 2715 errordlg('Argument of the operation must be scalar.')
wolffd@0 2716 set(small_val_h,'String','');
wolffd@0 2717 return;
wolffd@0 2718 end
wolffd@0 2719 if isreal(val)
wolffd@0 2720 data.state.small=val;
wolffd@0 2721 else
wolffd@0 2722 errordlg('Limits of the operation must be real.');
wolffd@0 2723 set(small_val_h,'String','');
wolffd@0 2724 return;
wolffd@0 2725 end
wolffd@0 2726 case 'equal'
wolffd@0 2727 equal_val_h=getfield(get(gcf,'UserData'),'equal_val_h');
wolffd@0 2728 val = str2num(get(equal_val_h,'String'));
wolffd@0 2729 dims=size(val);
wolffd@0 2730 if dims(1) ~= 1 | dims(2) ~= 1
wolffd@0 2731 errordlg('Argument of the operation must be scalar.');
wolffd@0 2732 set(equal_val_h,'String','');
wolffd@0 2733 return;
wolffd@0 2734 end
wolffd@0 2735 if isreal(val)
wolffd@0 2736 data.state.equal=val;
wolffd@0 2737 else
wolffd@0 2738 errordlg('Limits of the operation must be real.');
wolffd@0 2739 set(equal_val_h,'String','');
wolffd@0 2740 return;
wolffd@0 2741 end
wolffd@0 2742 case 'replace'
wolffd@0 2743 replace_val_h=getfield(get(gcf,'UserData'),'replace_val_h');
wolffd@0 2744 val=str2num(get(replace_val_h,'String'));
wolffd@0 2745 dims=size(val);
wolffd@0 2746 if (dims(1) ~= 1 | dims(2) ~= 1) & ~strcmp(get(gcf,'Tag'),'Select')
wolffd@0 2747 errordlg('Argument of the operation must be scalar.');
wolffd@0 2748 set(replace_val_h,'String','');
wolffd@0 2749 return;
wolffd@0 2750 end
wolffd@0 2751 if isreal(val)
wolffd@0 2752 data.state.replace=val;
wolffd@0 2753 else
wolffd@0 2754 errordlg('Limits of the operation must be real.');
wolffd@0 2755 set(replace_val_h,'String','');
wolffd@0 2756 return;
wolffd@0 2757 end
wolffd@0 2758 end
wolffd@0 2759
wolffd@0 2760 set(gcf,'UserData',data);
wolffd@0 2761
wolffd@0 2762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2763
wolffd@0 2764 %%% Subfunction: clip_data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 2765
wolffd@0 2766 function clip_data(arg)
wolffd@0 2767
wolffd@0 2768 %CLIP_DATA A callback function. Filters the data.
wolffd@0 2769 %
wolffd@0 2770 %
wolffd@0 2771
wolffd@0 2772 i=1;
wolffd@0 2773 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 2774 i=i+1;
wolffd@0 2775 end
wolffd@0 2776
wolffd@0 2777 arg2=arg(i+1:length(arg));
wolffd@0 2778 arg=arg(1:i-1);
wolffd@0 2779
wolffd@0 2780 if ~isempty(arg2)
wolffd@0 2781 LOG=1;
wolffd@0 2782 if strcmp(arg,'sel')
wolffd@0 2783 c_h=findobj(get(0,'Children'),'Tag','Select');
wolffd@0 2784 else
wolffd@0 2785 c_h=findobj(get(0,'Children'),'Tag','Clipping');
wolffd@0 2786 end
wolffd@0 2787 set(0,'CurrentFigure',c_h);
wolffd@0 2788 i=1;
wolffd@0 2789 while i <= length(arg2) & arg2(i) ~= ' '
wolffd@0 2790 i=i+1;
wolffd@0 2791 end
wolffd@0 2792 BT=str2num(arg2(1:i-1));
wolffd@0 2793 i=i+1;
wolffd@0 2794 j=i;
wolffd@0 2795 while i <= length(arg2) & arg2(i) ~= ' '
wolffd@0 2796 i=i+1;
wolffd@0 2797 end
wolffd@0 2798 ST=str2num(arg2(j:i-1));
wolffd@0 2799 i=i+1;
wolffd@0 2800 j=i;
wolffd@0 2801 while i <= length(arg2) & arg2(i) ~= ' '
wolffd@0 2802 i=i+1;
wolffd@0 2803 end
wolffd@0 2804 EQ=str2num(arg2(j:i-1));
wolffd@0 2805 i=i+1;
wolffd@0 2806 j=i;
wolffd@0 2807 while i <= length(arg2) & arg2(i) ~= ' '
wolffd@0 2808 i=i+1;
wolffd@0 2809 end
wolffd@0 2810 AND_OR=str2num(arg2(j:i-1));
wolffd@0 2811 i=i+1;
wolffd@0 2812 j=i;
wolffd@0 2813 while i <= length(arg2) & arg2(i) ~= ' '
wolffd@0 2814 i=i+1;
wolffd@0 2815 end
wolffd@0 2816 ALL_AMONG=str2num(arg2(j:i-1));
wolffd@0 2817 i=i+1;
wolffd@0 2818 j=i;
wolffd@0 2819 while i <= length(arg2)
wolffd@0 2820 i=i+1;
wolffd@0 2821 end
wolffd@0 2822 VECT_REPL=str2num(arg2(j:i-1));
wolffd@0 2823 else
wolffd@0 2824 LOG=0;
wolffd@0 2825 end
wolffd@0 2826
wolffd@0 2827 if ~LOG
wolffd@0 2828 big_val_h=getfield(get(gcf,'UserData'),'big_val_h');
wolffd@0 2829 small_val_h=getfield(get(gcf,'UserData'),'small_val_h');
wolffd@0 2830 equal_val_h=getfield(get(gcf,'UserData'),'equal_val_h');
wolffd@0 2831 replace_val_h=getfield(get(gcf,'UserData'),'replace_val_h');
wolffd@0 2832 end
wolffd@0 2833
wolffd@0 2834 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 2835
wolffd@0 2836 if isempty(pre_h)
wolffd@0 2837 errordlg('''Preprocess'' -figure does not exist. Terminating program...');
wolffd@0 2838 pro_tools('close');
wolffd@0 2839 return;
wolffd@0 2840 end
wolffd@0 2841
wolffd@0 2842 comp_names_h=getfield(get(pre_h,'UserData'),'comp_names_h');
wolffd@0 2843 selected=getfield(get(pre_h,'UserData'),'selected_vects');
wolffd@0 2844 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 2845 undo = sData;
wolffd@0 2846 state=getfield(get(gcf,'UserData'),'state');
wolffd@0 2847
wolffd@0 2848 if LOG
wolffd@0 2849 state.big=BT;
wolffd@0 2850 state.small=ST;
wolffd@0 2851 state.equal=EQ;
wolffd@0 2852 state.replace=VECT_REPL;
wolffd@0 2853 state.and=AND_OR;
wolffd@0 2854 state.all=ALL_AMONG;
wolffd@0 2855 end
wolffd@0 2856
wolffd@0 2857 if isempty(pre_h)
wolffd@0 2858 pro_tools('close');
wolffd@0 2859 end
wolffd@0 2860
wolffd@0 2861 if isempty(get(comp_names_h,'Value'))
wolffd@0 2862 clear_state_vals;
wolffd@0 2863 errordlg('There must be one component chosen for the operation.');
wolffd@0 2864 return;
wolffd@0 2865 end
wolffd@0 2866
wolffd@0 2867 n_th_comp=getfield(get_indices,{1});
wolffd@0 2868
wolffd@0 2869 if isempty(state.big) & isempty(state.small) & isempty(state.equal) & ...
wolffd@0 2870 strcmp(arg,'clip')
wolffd@0 2871 clear_state_vals;
wolffd@0 2872 errordlg('At least one limit must be chosen for the-operation.');
wolffd@0 2873 return;
wolffd@0 2874 end
wolffd@0 2875
wolffd@0 2876 if ~isempty(state.replace) & strcmp(arg,'sel')
wolffd@0 2877 if ~all(state.replace == round(state.replace)) | any(state.replace < 1)
wolffd@0 2878 errordlg('Indices of vectors must be positive integers.');
wolffd@0 2879 return;
wolffd@0 2880 elseif any(state.replace > length(sData.data(:,1)))
wolffd@0 2881 errordlg('Indices of the vectors to be selected are too big.');
wolffd@0 2882 return;
wolffd@0 2883 end
wolffd@0 2884 end
wolffd@0 2885
wolffd@0 2886 if isempty(state.replace) & strcmp(arg,'clip')
wolffd@0 2887 clear_state_vals;
wolffd@0 2888 errordlg('Replace value must be determined for Clipping-operation.');
wolffd@0 2889 return;
wolffd@0 2890 end
wolffd@0 2891
wolffd@0 2892 if isempty(state.big) & isempty(state.small) & isempty(state.equal) & ...
wolffd@0 2893 isempty(state.replace)
wolffd@0 2894 clear_state_vals;
wolffd@0 2895 return;
wolffd@0 2896 end
wolffd@0 2897
wolffd@0 2898 bt_indices=[];
wolffd@0 2899 lt_indices=[];
wolffd@0 2900 equal_indices=[];
wolffd@0 2901
wolffd@0 2902
wolffd@0 2903 if ~isempty(state.big)
wolffd@0 2904 if state.all
wolffd@0 2905 bt_indices=find(sData.data(:,n_th_comp) > state.big);
wolffd@0 2906 else
wolffd@0 2907 bt_indices=selected(find(sData.data(selected,n_th_comp) > state.big));
wolffd@0 2908 end
wolffd@0 2909 end
wolffd@0 2910
wolffd@0 2911 if ~isempty(state.small)
wolffd@0 2912 if state.all
wolffd@0 2913 lt_indices=find(sData.data(:,n_th_comp) < state.small);
wolffd@0 2914 else
wolffd@0 2915 lt_indices=selected(find(sData.data(selected,n_th_comp) < state.small));
wolffd@0 2916 end
wolffd@0 2917 end
wolffd@0 2918
wolffd@0 2919 if ~isempty(state.equal)
wolffd@0 2920 if isnan(state.equal)
wolffd@0 2921 if state.all
wolffd@0 2922 equal_indices=find(isnan(sData.data(:,n_th_comp)));
wolffd@0 2923 else
wolffd@0 2924 equal_indices=selected(find(isnan(sData.data(selected,n_th_comp))));
wolffd@0 2925 end
wolffd@0 2926 elseif state.all
wolffd@0 2927 equal_indices=find(sData.data(:,n_th_comp)==state.equal);
wolffd@0 2928 else
wolffd@0 2929 equal_indices=selected(find(sData.data(selected,n_th_comp)==state.equal));
wolffd@0 2930 end
wolffd@0 2931 end
wolffd@0 2932
wolffd@0 2933 if state.and
wolffd@0 2934
wolffd@0 2935 if ~isempty(bt_indices) | ~isempty(lt_indices) | ~isempty(equal_indices)...
wolffd@0 2936 | strcmp(arg,'sel')
wolffd@0 2937
wolffd@0 2938 if isempty(bt_indices) & isempty(lt_indices) & isempty(equal_indices) &...
wolffd@0 2939 isempty(state.replace)
wolffd@0 2940 clear_state_vals;
wolffd@0 2941 return;
wolffd@0 2942 end
wolffd@0 2943 if isempty(bt_indices)
wolffd@0 2944 if ~state.all
wolffd@0 2945 bt_indices=selected;
wolffd@0 2946 else
wolffd@0 2947 bt_indices=1:getfield(size(sData.data),{1});
wolffd@0 2948 end
wolffd@0 2949 end
wolffd@0 2950 if isempty(lt_indices)
wolffd@0 2951 if ~state.all
wolffd@0 2952 lt_indices=selected;
wolffd@0 2953 else
wolffd@0 2954 lt_indices=1:getfield(size(sData.data),{1});
wolffd@0 2955 end
wolffd@0 2956 end
wolffd@0 2957 if isempty(equal_indices)
wolffd@0 2958 if ~state.all
wolffd@0 2959 equal_indices=selected;
wolffd@0 2960 else
wolffd@0 2961 equal_indices=1:getfield(size(sData.data),{1});
wolffd@0 2962 end
wolffd@0 2963 end
wolffd@0 2964
wolffd@0 2965 indices=intersect(intersect(bt_indices,lt_indices),equal_indices);
wolffd@0 2966 if strcmp(arg,'sel')
wolffd@0 2967 if ~isempty(indices) | ~isempty(state.replace)
wolffd@0 2968 if isempty(state.replace)
wolffd@0 2969 NOTEMPTY=0;
wolffd@0 2970 if ~state.all
wolffd@0 2971 state.replace=selected;
wolffd@0 2972 else
wolffd@0 2973 state.replace=1:getfield(size(sData.data),{1});
wolffd@0 2974 end
wolffd@0 2975 else
wolffd@0 2976 NOTEMPTY=1;
wolffd@0 2977 end
wolffd@0 2978 if isempty(indices)
wolffd@0 2979 indices=selected;
wolffd@0 2980 end
wolffd@0 2981 indices=intersect(indices,state.replace);
wolffd@0 2982 if isempty(indices)
wolffd@0 2983 indices=selected;
wolffd@0 2984 end
wolffd@0 2985 data=get(pre_h,'UserData');
wolffd@0 2986 data.undo.sData=sData;
wolffd@0 2987 data.undo.selected=data.selected_vects;
wolffd@0 2988 data.selected_vects=indices;
wolffd@0 2989 if ~LOG
wolffd@0 2990 if ~NOTEMPTY
wolffd@0 2991 data.LOG{length(data.LOG)+1}='% Select vectors.';
wolffd@0 2992 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''clip_data'',''',...
wolffd@0 2993 arg,...
wolffd@0 2994 ' ',num2str(state.big),...
wolffd@0 2995 ' ',num2str(state.small),...
wolffd@0 2996 ' ',num2str(state.equal),...
wolffd@0 2997 ' ',num2str(state.and),...
wolffd@0 2998 ' ',num2str(state.all),...
wolffd@0 2999 ''');');
wolffd@0 3000 else
wolffd@0 3001 code=write_log_code(state.replace,...
wolffd@0 3002 arg,...
wolffd@0 3003 state.big,...
wolffd@0 3004 state.small,...
wolffd@0 3005 state.equal,...
wolffd@0 3006 state.and,...
wolffd@0 3007 state.all);
wolffd@0 3008 data.LOG(length(data.LOG)+1:length(data.LOG)+length(code))=code;
wolffd@0 3009 end
wolffd@0 3010 end
wolffd@0 3011 set(pre_h,'UserData',data);
wolffd@0 3012 old=gcf;
wolffd@0 3013 set(0,'CurrentFigure',pre_h);
wolffd@0 3014 sel_comp;
wolffd@0 3015 cplot_mimema;
wolffd@0 3016 vect_means(data.sData,data.vect_mean_h,data.selected_vects);
wolffd@0 3017 set(0,'CurrentFigure',old);
wolffd@0 3018 end
wolffd@0 3019 clear_state_vals;
wolffd@0 3020 return;
wolffd@0 3021 end
wolffd@0 3022 sData.data(indices,n_th_comp) = state.replace;
wolffd@0 3023 sData.MODIFIED=1;
wolffd@0 3024 end
wolffd@0 3025 else
wolffd@0 3026 indices=union(union(bt_indices,lt_indices),equal_indices);
wolffd@0 3027 if ~isempty(indices) | strcmp(arg,'sel')
wolffd@0 3028 if strcmp(arg,'sel')
wolffd@0 3029 if ~isempty(indices) | ~isempty(state.replace')
wolffd@0 3030 data=get(pre_h,'UserData');
wolffd@0 3031 data.undo.sData=sData;
wolffd@0 3032 data.undo.selected=data.selected_vects;
wolffd@0 3033 data.selected_vects=union(indices,state.replace);
wolffd@0 3034 if ~LOG
wolffd@0 3035 if isempty(state.replace);
wolffd@0 3036 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''clip_data'',''',...
wolffd@0 3037 arg,...
wolffd@0 3038 ' ',num2str(state.big),...
wolffd@0 3039 ' ',num2str(state.small),...
wolffd@0 3040 ' ',num2str(state.equal),...
wolffd@0 3041 ' ',num2str(state.and),...
wolffd@0 3042 ' ',num2str(state.all),...
wolffd@0 3043 ''');');
wolffd@0 3044 else
wolffd@0 3045 code=write_log_code(state.replace,...
wolffd@0 3046 arg,...
wolffd@0 3047 state.big,...
wolffd@0 3048 state.small,...
wolffd@0 3049 state.equal,...
wolffd@0 3050 state.and,...
wolffd@0 3051 state.all);
wolffd@0 3052 data.LOG(length(data.LOG)+1:length(data.LOG)+length(code))=code;
wolffd@0 3053 end
wolffd@0 3054 end
wolffd@0 3055 set(pre_h,'UserData',data);
wolffd@0 3056 old=gcf;
wolffd@0 3057 set(0,'CurrentFigure',pre_h);
wolffd@0 3058 sel_comp;
wolffd@0 3059 vect_means(data.sData,data.vect_mean_h,data.selected_vects);
wolffd@0 3060 cplot_mimema;
wolffd@0 3061 set(0,'CurrentFigure',old);
wolffd@0 3062 end
wolffd@0 3063 clear_state_vals;
wolffd@0 3064 return;
wolffd@0 3065 end
wolffd@0 3066 sData.data(indices,n_th_comp)=state.replace;
wolffd@0 3067 sData.MODIFIED=1;
wolffd@0 3068 end
wolffd@0 3069 end
wolffd@0 3070
wolffd@0 3071 if sData.MODIFIED
wolffd@0 3072 data=get(pre_h,'UserData');
wolffd@0 3073 data.sData=sData;
wolffd@0 3074 data.undo.sData=undo;
wolffd@0 3075 if ~LOG
wolffd@0 3076 if strcmp(arg,'sel')
wolffd@0 3077 data.LOG{length(data.LOG)+1}='% Select vectors';
wolffd@0 3078 else
wolffd@0 3079 data.LOG{length(data.LOG)+1}='% Clip values.';
wolffd@0 3080 end
wolffd@0 3081 if strcmp(arg,'clip') | isempty(state.replace)
wolffd@0 3082 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''clip_data'',''',arg,...
wolffd@0 3083 ' ',num2str(state.big),...
wolffd@0 3084 ' ',num2str(state.small),...
wolffd@0 3085 ' ',num2str(state.equal),...
wolffd@0 3086 ' ',num2str(state.and),...
wolffd@0 3087 ' ',num2str(state.all),...
wolffd@0 3088 ' ',num2str(state.replace),...
wolffd@0 3089 ''');');
wolffd@0 3090 else
wolffd@0 3091 code=write_log_code(state.replace,...
wolffd@0 3092 arg,...
wolffd@0 3093 state.big,...
wolffd@0 3094 state.small,...
wolffd@0 3095 state.equal,...
wolffd@0 3096 state.and,...
wolffd@0 3097 state.all);
wolffd@0 3098 data.LOG(length(data.LOG)+1:length(data.LOG)+length(code))=code;
wolffd@0 3099 end
wolffd@0 3100 end
wolffd@0 3101 set(pre_h,'UserData',data);
wolffd@0 3102 old=gcf;
wolffd@0 3103 set(0,'CurrentFigure',pre_h)
wolffd@0 3104
wolffd@0 3105 vector_h=getfield(get(gcf,'UserData'),'vector_h');
wolffd@0 3106 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 3107 set(gcf,'CurrentAxes',vector_h);
wolffd@0 3108 vect_means(sData,vect_mean_h,selected);
wolffd@0 3109 cplot_mimema;
wolffd@0 3110 sel_comp;
wolffd@0 3111
wolffd@0 3112 set(0,'CurrentFigure',old);
wolffd@0 3113 end
wolffd@0 3114
wolffd@0 3115 clear_state_vals;
wolffd@0 3116
wolffd@0 3117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3118
wolffd@0 3119 %%% Subfunction: clear_state_vals %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3120
wolffd@0 3121 function clear_state_vals
wolffd@0 3122
wolffd@0 3123 %CLEAR_STATE_VALS Sets the fields of the UserData's state-struct empty.
wolffd@0 3124 %
wolffd@0 3125 %
wolffd@0 3126
wolffd@0 3127
wolffd@0 3128 data=get(gcf,'UserData');
wolffd@0 3129 set(data.big_val_h,'String','');
wolffd@0 3130 set(data.small_val_h,'String','');
wolffd@0 3131 set(data.equal_val_h,'String','');
wolffd@0 3132 set(data.replace_val_h,'String','');
wolffd@0 3133 data.state.big=[];
wolffd@0 3134 data.state.small=[];
wolffd@0 3135 data.state.equal=[];
wolffd@0 3136 data.state.replace=[];
wolffd@0 3137 set(gcf,'UserData',data);
wolffd@0 3138
wolffd@0 3139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3140
wolffd@0 3141 function delay(varargin)
wolffd@0 3142
wolffd@0 3143 delay_h=findobj(get(0,'Children'),'Tag','Delay');
wolffd@0 3144
wolffd@0 3145 if nargin ~= 1
wolffd@0 3146 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 3147 preh_udata=get(pre_h,'UserData');
wolffd@0 3148 preh_udata.LOG{length(preh_udata.LOG)+1}=...
wolffd@0 3149 '% Starting the ''Delay'' -window...';
wolffd@0 3150 preh_udata.LOG{length(preh_udata.LOG)+1}='preprocess(''delay'',''foo'');';
wolffd@0 3151 set(pre_h,'UserData',preh_udata);
wolffd@0 3152 end
wolffd@0 3153
wolffd@0 3154 if ~isempty(delay_h)
wolffd@0 3155 figure(delay_h);
wolffd@0 3156 return;
wolffd@0 3157 end
wolffd@0 3158
wolffd@0 3159 h0 = figure('Color',[0.8 0.8 0.8], ...
wolffd@0 3160 'PaperPosition',[18 180 576 432], ...
wolffd@0 3161 'PaperUnits','points', ...
wolffd@0 3162 'Position',[759 664 162 215], ...
wolffd@0 3163 'Tag','Delay');
wolffd@0 3164
wolffd@0 3165 h1 = uicontrol('Parent',h0, ...
wolffd@0 3166 'Units','normalized', ...
wolffd@0 3167 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 3168 'ListboxTop',0, ...
wolffd@0 3169 'Position',[0.05555555555555555 0.2046511627906977 0.8950617283950617 0.7441860465116279], ...
wolffd@0 3170 'Style','frame', ...
wolffd@0 3171 'Tag','Frame1');
wolffd@0 3172
wolffd@0 3173 h1 = uicontrol('Parent',h0, ...
wolffd@0 3174 'Units','normalized', ...
wolffd@0 3175 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3176 'ListboxTop',0, ...
wolffd@0 3177 'Position',[0.08641975308641975 0.6976744186046512 0.8333333333333333 0.2232558139534884], ...
wolffd@0 3178 'Style','frame', ...
wolffd@0 3179 'Tag','Frame2');
wolffd@0 3180
wolffd@0 3181 h1 = uicontrol('Parent',h0, ...
wolffd@0 3182 'Units','normalized', ...
wolffd@0 3183 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3184 'ListboxTop',0, ...
wolffd@0 3185 'Position',[0.08641975308641975 0.227906976744186 0.8333333333333333 0.4418604651162791], ...
wolffd@0 3186 'Style','frame', ...
wolffd@0 3187 'Tag','Frame3');
wolffd@0 3188
wolffd@0 3189 h1 = uicontrol('Parent',h0, ...
wolffd@0 3190 'Units','normalized', ...
wolffd@0 3191 'Callback','preprocess delay_data',...
wolffd@0 3192 'FontWeight','demi', ...
wolffd@0 3193 'ListboxTop',0, ...
wolffd@0 3194 'Position',[0.0556 0.0326 0.4012 0.1163], ...
wolffd@0 3195 'String','OK', ...
wolffd@0 3196 'Tag','Pushbutton1');
wolffd@0 3197
wolffd@0 3198 h1 = uicontrol('Parent',h0, ...
wolffd@0 3199 'Units','normalized', ...
wolffd@0 3200 'Callback','preprocess close_d',...
wolffd@0 3201 'FontWeight','demi', ...
wolffd@0 3202 'ListboxTop',0, ...
wolffd@0 3203 'Position',[0.5494 0.0326 0.4012 0.1163], ...
wolffd@0 3204 'String','Close', ...
wolffd@0 3205 'Tag','Pushbutton2');
wolffd@0 3206
wolffd@0 3207 h1 = uicontrol('Parent',h0, ...
wolffd@0 3208 'Units','normalized', ...
wolffd@0 3209 'BackgroundColor',[1 1 1], ...
wolffd@0 3210 'ListboxTop',0, ...
wolffd@0 3211 'Position',[0.4876543209876543 0.7534883720930232 0.3518518518518519 0.1255813953488372], ...
wolffd@0 3212 'Style','edit', ...
wolffd@0 3213 'Tag','EditText1');
wolffd@0 3214
wolffd@0 3215 data.delay_val_h = h1;
wolffd@0 3216
wolffd@0 3217 h1 = uicontrol('Parent',h0, ...
wolffd@0 3218 'Units','normalized', ...
wolffd@0 3219 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3220 'FontWeight','demi', ...
wolffd@0 3221 'HorizontalAlignment','left', ...
wolffd@0 3222 'ListboxTop',0, ...
wolffd@0 3223 'Position',[0.1173 0.7860 0.3086 0.0651], ...
wolffd@0 3224 'String','Delay', ...
wolffd@0 3225 'Style','text', ...
wolffd@0 3226 'Tag','StaticText1');
wolffd@0 3227
wolffd@0 3228 h1 = uicontrol('Parent',h0, ...
wolffd@0 3229 'Units','normalized', ...
wolffd@0 3230 'Callback','preprocess clip_exp_cb c_this',...
wolffd@0 3231 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3232 'ListboxTop',0, ...
wolffd@0 3233 'Position',[0.1173 0.5349 0.1173 0.0837], ...
wolffd@0 3234 'Style','radiobutton', ...
wolffd@0 3235 'Tag','Radiobutton1');
wolffd@0 3236
wolffd@0 3237 data.c_this_button_h=h1;
wolffd@0 3238 data.mode='c_this';
wolffd@0 3239
wolffd@0 3240 h1 = uicontrol('Parent',h0, ...
wolffd@0 3241 'Units','normalized', ...
wolffd@0 3242 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3243 'Callback','preprocess clip_exp_cb c_all',...
wolffd@0 3244 'ListboxTop',0, ...
wolffd@0 3245 'Position',[0.1173 0.4047 0.1173 0.0837], ...
wolffd@0 3246 'Style','radiobutton', ...
wolffd@0 3247 'Tag','Radiobutton2');
wolffd@0 3248
wolffd@0 3249 data.c_all_button_h=h1;
wolffd@0 3250
wolffd@0 3251 h1 = uicontrol('Parent',h0, ...
wolffd@0 3252 'Units','normalized', ...
wolffd@0 3253 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3254 'Callback','preprocess clip_exp_cb e_all',...
wolffd@0 3255 'ListboxTop',0, ...
wolffd@0 3256 'Position',[0.1173 0.2651 0.1173 0.0837], ...
wolffd@0 3257 'Style','radiobutton', ...
wolffd@0 3258 'Tag','Radiobutton3');
wolffd@0 3259
wolffd@0 3260 data.e_all_button_h=h1;
wolffd@0 3261
wolffd@0 3262
wolffd@0 3263 h1 = uicontrol('Parent',h0, ...
wolffd@0 3264 'Units','normalized', ...
wolffd@0 3265 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3266 'FontWeight','demi', ...
wolffd@0 3267 'FontSize',8,...
wolffd@0 3268 'HorizontalAlignment','left', ...
wolffd@0 3269 'ListboxTop',0, ...
wolffd@0 3270 'Position',[0.26 0.5534883720930233 0.4135802469135802 0.06511627906976744], ...
wolffd@0 3271 'String','Clip this', ...
wolffd@0 3272 'Style','text', ...
wolffd@0 3273 'Tag','StaticText2');
wolffd@0 3274 h1 = uicontrol('Parent',h0, ...
wolffd@0 3275 'Units','normalized', ...
wolffd@0 3276 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3277 'FontWeight','demi', ...
wolffd@0 3278 'FontSize',8,...
wolffd@0 3279 'HorizontalAlignment','left', ...
wolffd@0 3280 'ListboxTop',0, ...
wolffd@0 3281 'Position',[0.26 0.413953488372093 0.3765432098765432 0.06511627906976744], ...
wolffd@0 3282 'String','Clip all', ...
wolffd@0 3283 'Style','text', ...
wolffd@0 3284 'Tag','StaticText3');
wolffd@0 3285 h1 = uicontrol('Parent',h0, ...
wolffd@0 3286 'Units','normalized', ...
wolffd@0 3287 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3288 'FontWeight','demi', ...
wolffd@0 3289 'FontSize',8,...
wolffd@0 3290 'HorizontalAlignment','left', ...
wolffd@0 3291 'ListboxTop',0, ...
wolffd@0 3292 'Position',[0.26 0.2744186046511628 0.4197530864197531 0.06511627906976744], ...
wolffd@0 3293 'String','Expand all', ...
wolffd@0 3294 'Style','text', ...
wolffd@0 3295 'Tag','StaticText4');
wolffd@0 3296
wolffd@0 3297
wolffd@0 3298 set(gcf,'UserData',data);
wolffd@0 3299
wolffd@0 3300 %%% Subfunction clip_exp_cb %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3301
wolffd@0 3302 function clip_exp_cb(arg)
wolffd@0 3303
wolffd@0 3304 c_this_button_h=getfield(get(gcf,'UserData'),'c_this_button_h');
wolffd@0 3305 c_all_button_h=getfield(get(gcf,'UserData'),'c_all_button_h');
wolffd@0 3306 e_all_button_h=getfield(get(gcf,'UserData'),'e_all_button_h');
wolffd@0 3307 data=get(gcf,'UserData');
wolffd@0 3308
wolffd@0 3309
wolffd@0 3310 switch arg
wolffd@0 3311 case 'c_this'
wolffd@0 3312 set(c_all_button_h,'Value',0);
wolffd@0 3313 set(e_all_button_h,'Value',0);
wolffd@0 3314 set(c_this_button_h,'Value',1);
wolffd@0 3315 data.mode='c_this';
wolffd@0 3316 case 'c_all'
wolffd@0 3317 set(c_this_button_h,'Value',0);
wolffd@0 3318 set(e_all_button_h,'Value',0);
wolffd@0 3319 set(c_all_button_h,'Value',1);
wolffd@0 3320 data.mode='c_all';
wolffd@0 3321 case 'e_all'
wolffd@0 3322 set(c_this_button_h,'Value',0);
wolffd@0 3323 set(c_all_button_h,'Value',0);
wolffd@0 3324 set(e_all_button_h,'Value',1);
wolffd@0 3325 data.mode='e_all';
wolffd@0 3326 end
wolffd@0 3327
wolffd@0 3328 set(gcf,'UserData',data);
wolffd@0 3329
wolffd@0 3330 %%% Subfunction: delay_data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3331
wolffd@0 3332 function delay_data(varargin)
wolffd@0 3333
wolffd@0 3334 if nargin == 1
wolffd@0 3335 del_h=findobj(get(0,'Children'),'Tag','Delay');
wolffd@0 3336 set(0,'CurrentFigure',del_h);
wolffd@0 3337 LOG=1;
wolffd@0 3338 arg=varargin{1};
wolffd@0 3339 i=1;
wolffd@0 3340 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 3341 i=i+1;
wolffd@0 3342 end
wolffd@0 3343 delay=str2num(arg(1:i-1));
wolffd@0 3344 no=str2num(arg(i+1:length(arg)));
wolffd@0 3345 else
wolffd@0 3346 LOG=0;
wolffd@0 3347 end
wolffd@0 3348
wolffd@0 3349 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 3350 q='Delay operation is not evaluated.';
wolffd@0 3351 t='Warning';
wolffd@0 3352 if isempty(pre_h)
wolffd@0 3353 errordlg('''Preprocess'' -figure does not exist. Terminating program...');
wolffd@0 3354 pro_tools('close');
wolffd@0 3355 return;
wolffd@0 3356 end
wolffd@0 3357
wolffd@0 3358 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 3359 undo = sData;
wolffd@0 3360 data=get(gcf,'UserData');
wolffd@0 3361 if ~LOG
wolffd@0 3362 delay=str2num(get(data.delay_val_h,'String'));
wolffd@0 3363 if isempty(delay)
wolffd@0 3364 errordlg('Value of ''Delay'' must be defined.');
wolffd@0 3365 return
wolffd@0 3366 end
wolffd@0 3367 set(data.delay_val_h,'String','');
wolffd@0 3368 if round(delay) ~= delay
wolffd@0 3369 errordlg('Value of ''Delay'' must be integer.');
wolffd@0 3370 return;
wolffd@0 3371 end
wolffd@0 3372 end
wolffd@0 3373 comp_names_h=getfield(get(pre_h,'UserData'),'comp_names_h');
wolffd@0 3374 if isempty(get(comp_names_h,'Value'))
wolffd@0 3375 errordlg('There are not components chosen.');
wolffd@0 3376 return;
wolffd@0 3377 end
wolffd@0 3378 n_th_comp=getfield(get_indices,{1});
wolffd@0 3379 len=length(sData.data(:,1));
wolffd@0 3380
wolffd@0 3381 if LOG
wolffd@0 3382 switch no
wolffd@0 3383 case 1
wolffd@0 3384 data.mode='c_this';
wolffd@0 3385 preprocess('clip_exp_cb','c_this');
wolffd@0 3386 case 2
wolffd@0 3387 data.mode='c_all';
wolffd@0 3388 preprocess('clip_exp_cb','c_all');
wolffd@0 3389 case 3
wolffd@0 3390 data.mode='e_all';
wolffd@0 3391 preprocess('clip_exp_cb','e_all');
wolffd@0 3392 end
wolffd@0 3393 end
wolffd@0 3394
wolffd@0 3395 switch data.mode
wolffd@0 3396 case 'c_this'
wolffd@0 3397 MODE='1';
wolffd@0 3398 if delay > 0
wolffd@0 3399 sData.data(delay+1:len,n_th_comp)=sData.data(1:len-delay);
wolffd@0 3400 if delay >= len
wolffd@0 3401 errordlg(q,t);
wolffd@0 3402 return;
wolffd@0 3403 else
wolffd@0 3404 sData.data(1:delay,n_th_comp)=NaN;
wolffd@0 3405 end
wolffd@0 3406 elseif delay < 0
wolffd@0 3407 sData.data(1:len+delay,n_th_comp)=...
wolffd@0 3408 sData.data(abs(delay)+1:len,n_th_comp);
wolffd@0 3409 if abs(delay) >= len
wolffd@0 3410 errordlg(q,t);
wolffd@0 3411 return;
wolffd@0 3412 else
wolffd@0 3413 sData.data(len+delay+1:len,n_th_comp)=NaN;
wolffd@0 3414 end
wolffd@0 3415 end
wolffd@0 3416 if delay ~= 0
wolffd@0 3417 data=get(pre_h,'UserData');
wolffd@0 3418 sData.MODIFIED=1;
wolffd@0 3419 sData.comp_norm(n_th_comp)=[];
wolffd@0 3420 data.sData=sData;
wolffd@0 3421 data.undo.sData=undo;
wolffd@0 3422 set(pre_h,'UserData',data);
wolffd@0 3423 old = gcf;
wolffd@0 3424 set(0,'CurrentFigure',pre_h);
wolffd@0 3425 sel_comp;
wolffd@0 3426 cplot_mimema;
wolffd@0 3427 set(0,'CurrentFigure',old);
wolffd@0 3428 end
wolffd@0 3429 case 'c_all'
wolffd@0 3430 MODE='2';
wolffd@0 3431 if delay > 0
wolffd@0 3432 sData.data(delay+1:len,n_th_comp)=sData.data(1:len-delay,n_th_comp);
wolffd@0 3433 if delay >= len
wolffd@0 3434 errordlg(q,t);
wolffd@0 3435 return;
wolffd@0 3436 else
wolffd@0 3437 sData.data=sData.data(delay+1:len,:);
wolffd@0 3438 end
wolffd@0 3439 elseif delay < 0
wolffd@0 3440 sData.data(1:len+delay,n_th_comp)=sData.data(abs(delay)+1:len,n_th_comp);
wolffd@0 3441 if abs(delay) >= len
wolffd@0 3442 errordlg(q,t);
wolffd@0 3443 return;
wolffd@0 3444 else
wolffd@0 3445 sData.data=sData.data(1:len+delay,:);
wolffd@0 3446 end
wolffd@0 3447 end
wolffd@0 3448 if delay ~= 0
wolffd@0 3449 data=get(pre_h,'UserData');
wolffd@0 3450 sData.MODIFIED=1;
wolffd@0 3451 sData.comp_norm(:,:)={[]};
wolffd@0 3452 data.sData=sData;
wolffd@0 3453 data.undo.sData=undo;
wolffd@0 3454 data.undo.selected=data.selected_vects;
wolffd@0 3455 if delay > 0
wolffd@0 3456 data.selected_vects=...
wolffd@0 3457 data.selected_vects(find(data.selected_vects>delay));
wolffd@0 3458 data.selected_vects=data.selected_vects-delay;
wolffd@0 3459 elseif nargin == 1
wolffd@0 3460 data.selected_vects=...
wolffd@0 3461 data.selected_vects(find(data.selected_vects<=len-abs(delay)));
wolffd@0 3462 end
wolffd@0 3463 set(pre_h,'UserData',data);
wolffd@0 3464 old=gcf;
wolffd@0 3465 set(0,'CurrentFigure',pre_h);
wolffd@0 3466 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 3467 vects(data.selected_vects)=1;
wolffd@0 3468 write_sD_stats;
wolffd@0 3469 draw_vectors(vects,data.vector_h);
wolffd@0 3470 sel_comp;
wolffd@0 3471 cplot_mimema;
wolffd@0 3472 set(0,'CurrentFigure',old);
wolffd@0 3473 end
wolffd@0 3474 case 'e_all'
wolffd@0 3475 MODE='3';
wolffd@0 3476 if delay > 0
wolffd@0 3477 sData.data(len+1:len+delay,:)=NaN;
wolffd@0 3478 sData.data(1+delay:delay+len,n_th_comp)=sData.data(1:len,n_th_comp);
wolffd@0 3479 sData.data(1:delay,n_th_comp)=NaN;
wolffd@0 3480 elseif delay < 0
wolffd@0 3481 delay=abs(delay);
wolffd@0 3482 sData.data(delay+1:len+delay,:)=sData.data;
wolffd@0 3483 sData.data(1:delay,:)=NaN;
wolffd@0 3484 sData.data(1:len,n_th_comp)=sData.data(delay+1:len+delay,n_th_comp);
wolffd@0 3485 sData.data(len+1:len+delay,n_th_comp)=NaN;
wolffd@0 3486 end
wolffd@0 3487 if delay ~= 0
wolffd@0 3488 data=get(pre_h,'UserData');
wolffd@0 3489 sData.MODIFIED=1;
wolffd@0 3490 sData.comp_norm(:,:)={[]};
wolffd@0 3491 data.sData=sData;
wolffd@0 3492 data.undo.sData=undo;
wolffd@0 3493 data.undo.selected=data.selected_vects;
wolffd@0 3494 set(pre_h,'UserData',data);
wolffd@0 3495 old=gcf;
wolffd@0 3496 set(0,'CurrentFigure',pre_h);
wolffd@0 3497 write_sD_stats;
wolffd@0 3498 pro_tools('selall');
wolffd@0 3499 set(0,'CurrentFigure',old);
wolffd@0 3500 end
wolffd@0 3501 end
wolffd@0 3502
wolffd@0 3503 if ~LOG
wolffd@0 3504 data=get(pre_h,'UserData');
wolffd@0 3505 data.LOG{length(data.LOG)+1}='% Delay a component.';
wolffd@0 3506 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''delay_data'',''',...
wolffd@0 3507 num2str(delay),' ',MODE,''');');
wolffd@0 3508 set(pre_h,'UserData',data);
wolffd@0 3509 end
wolffd@0 3510
wolffd@0 3511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3512
wolffd@0 3513 function window(varargin)
wolffd@0 3514
wolffd@0 3515 if nargin ~= 1
wolffd@0 3516 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 3517 preh_udata=get(pre_h,'UserData');
wolffd@0 3518 preh_udata.LOG{length(preh_udata.LOG)+1}=...
wolffd@0 3519 '% Starting the ''Windowed'' -window...';
wolffd@0 3520 preh_udata.LOG{length(preh_udata.LOG)+1}='preprocess(''window'',''foo'');';
wolffd@0 3521 set(pre_h,'UserData',preh_udata);
wolffd@0 3522 end
wolffd@0 3523
wolffd@0 3524 win_h=findobj(get(0,'Children'),'Tag','Window');
wolffd@0 3525
wolffd@0 3526 if ~isempty(win_h)
wolffd@0 3527 figure(win_h);
wolffd@0 3528 return;
wolffd@0 3529 end
wolffd@0 3530
wolffd@0 3531 h0 = figure('Color',[0.8 0.8 0.8], ...
wolffd@0 3532 'PaperPosition',[18 180 576 432], ...
wolffd@0 3533 'PaperUnits','points', ...
wolffd@0 3534 'Position',[513 703 288 219], ...
wolffd@0 3535 'Tag','Window');
wolffd@0 3536
wolffd@0 3537 h1 = uicontrol('Parent',h0, ...
wolffd@0 3538 'Units','normalized', ...
wolffd@0 3539 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
wolffd@0 3540 'ListboxTop',0, ...
wolffd@0 3541 'Position',[0.03125 0.1552511415525114 0.9375 0.7990867579908676], ...
wolffd@0 3542 'Style','frame', ...
wolffd@0 3543 'Tag','Frame1');
wolffd@0 3544 h1 = uicontrol('Parent',h0, ...
wolffd@0 3545 'Units','normalized', ...
wolffd@0 3546 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3547 'ListboxTop',0, ...
wolffd@0 3548 'Position',[0.04861111111111111 0.7214611872146118 0.9027777777777777 0.2009132420091324], ...
wolffd@0 3549 'Style','frame', ...
wolffd@0 3550 'Tag','Frame2');
wolffd@0 3551 h1 = uicontrol('Parent',h0, ...
wolffd@0 3552 'Units','normalized', ...
wolffd@0 3553 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3554 'ListboxTop',0, ...
wolffd@0 3555 'Position',[0.04861111111111111 0.1780821917808219 0.2777777777777778 0.5251141552511416], ...
wolffd@0 3556 'Style','frame', ...
wolffd@0 3557 'Tag','Frame3');
wolffd@0 3558 h1 = uicontrol('Parent',h0, ...
wolffd@0 3559 'Units','normalized', ...
wolffd@0 3560 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3561 'ListboxTop',0, ...
wolffd@0 3562 'Position',[0.3611111111111111 0.1780821917808219 0.2777777777777778 0.5251141552511416], ...
wolffd@0 3563 'Style','frame', ...
wolffd@0 3564 'Tag','Frame4');
wolffd@0 3565 h1 = uicontrol('Parent',h0, ...
wolffd@0 3566 'Units','normalized', ...
wolffd@0 3567 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3568 'ListboxTop',0, ...
wolffd@0 3569 'Position',[0.6736111111111111 0.1780821917808219 0.2777777777777778 0.5251141552511416], ...
wolffd@0 3570 'Style','frame', ...
wolffd@0 3571 'Tag','Frame5');
wolffd@0 3572
wolffd@0 3573 h1 = uicontrol('Parent',h0, ...
wolffd@0 3574 'Callback','preprocess eval_windowed',...
wolffd@0 3575 'Units','normalized', ...
wolffd@0 3576 'FontWeight','demi', ...
wolffd@0 3577 'ListboxTop',0, ...
wolffd@0 3578 'Position',[0.03125 0.0319634703196347 0.2256944444444444 0.091324200913242], ...
wolffd@0 3579 'String','OK', ...
wolffd@0 3580 'Tag','Pushbutton1');
wolffd@0 3581
wolffd@0 3582 h1 = uicontrol('Parent',h0, ...
wolffd@0 3583 'Callback','preprocess close_w', ...
wolffd@0 3584 'Units','normalized', ...
wolffd@0 3585 'FontWeight','demi', ...
wolffd@0 3586 'ListboxTop',0, ...
wolffd@0 3587 'Position',[0.7430555555555555 0.0319634703196347 0.2256944444444444 0.091324200913242], ...
wolffd@0 3588 'String','Close', ...
wolffd@0 3589 'Tag','Pushbutton2');
wolffd@0 3590
wolffd@0 3591 h1 = uicontrol('Parent',h0, ...
wolffd@0 3592 'Units','normalized', ...
wolffd@0 3593 'BackgroundColor',[1 1 1], ...
wolffd@0 3594 'ListboxTop',0, ...
wolffd@0 3595 'Position',[0.7083333333333333 0.7625570776255708 0.2083333333333333 0.1232876712328767], ...
wolffd@0 3596 'Style','edit', ...
wolffd@0 3597 'Tag','EditText1');
wolffd@0 3598
wolffd@0 3599 data.win_len_h=h1;
wolffd@0 3600
wolffd@0 3601 h1 = uicontrol('Parent',h0, ...
wolffd@0 3602 'Units','normalized', ...
wolffd@0 3603 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3604 'FontWeight','demi', ...
wolffd@0 3605 'HorizontalAlignment','left', ...
wolffd@0 3606 'ListboxTop',0, ...
wolffd@0 3607 'Position',[0.07638888888888888 0.8036529680365296 0.3784722222222222 0.0547945205479452], ...
wolffd@0 3608 'String','Window length', ...
wolffd@0 3609 'Style','text', ...
wolffd@0 3610 'Tag','StaticText1');
wolffd@0 3611
wolffd@0 3612 h1 = uicontrol('Parent',h0, ...
wolffd@0 3613 'Units','normalized', ...
wolffd@0 3614 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3615 'Callback','preprocess window_cb centered',...
wolffd@0 3616 'ListboxTop',0, ...
wolffd@0 3617 'Position',[0.06597222222222222 0.5616438356164384 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3618 'Style','radiobutton', ...
wolffd@0 3619 'Tag','Radiobutton1');
wolffd@0 3620
wolffd@0 3621 data.centered_h=h1;
wolffd@0 3622 data.position='center';
wolffd@0 3623
wolffd@0 3624 h1 = uicontrol('Parent',h0, ...
wolffd@0 3625 'Units','normalized', ...
wolffd@0 3626 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3627 'Callback','preprocess window_cb previous',...
wolffd@0 3628 'ListboxTop',0, ...
wolffd@0 3629 'Position',[0.06597222222222222 0.4018264840182648 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3630 'Style','radiobutton', ...
wolffd@0 3631 'Tag','Radiobutton2');
wolffd@0 3632
wolffd@0 3633 data.previous_h=h1;
wolffd@0 3634
wolffd@0 3635 h1 = uicontrol('Parent',h0, ...
wolffd@0 3636 'Units','normalized', ...
wolffd@0 3637 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3638 'Callback','preprocess window_cb next',...
wolffd@0 3639 'ListboxTop',0, ...
wolffd@0 3640 'Position',[0.06597222222222222 0.2465753424657534 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3641 'Style','radiobutton', ...
wolffd@0 3642 'Tag','Radiobutton3');
wolffd@0 3643
wolffd@0 3644 data.next_h=h1;
wolffd@0 3645
wolffd@0 3646 h1 = uicontrol('Parent',h0, ...
wolffd@0 3647 'Units','normalized', ...
wolffd@0 3648 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3649 'Callback','preprocess window_cb mean',...
wolffd@0 3650 'ListboxTop',0, ...
wolffd@0 3651 'Position',[0.3784722222222222 0.5799086757990868 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3652 'Style','radiobutton', ...
wolffd@0 3653 'Tag','Radiobutton4');
wolffd@0 3654
wolffd@0 3655 data.mean_h=h1;
wolffd@0 3656 data.mode='mean';
wolffd@0 3657
wolffd@0 3658
wolffd@0 3659 h1 = uicontrol('Parent',h0, ...
wolffd@0 3660 'Units','normalized', ...
wolffd@0 3661 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3662 'Callback','preprocess window_cb median',...
wolffd@0 3663 'ListboxTop',0, ...
wolffd@0 3664 'Position',[0.3784722222222222 0.4611872146118721 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3665 'Style','radiobutton', ...
wolffd@0 3666 'Tag','Radiobutton5');
wolffd@0 3667
wolffd@0 3668
wolffd@0 3669 data.median_h=h1;
wolffd@0 3670
wolffd@0 3671 h1 = uicontrol('Parent',h0, ...
wolffd@0 3672 'Units','normalized', ...
wolffd@0 3673 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3674 'Callback','preprocess window_cb max',...
wolffd@0 3675 'ListboxTop',0, ...
wolffd@0 3676 'Position',[0.3784722222222222 0.3515981735159817 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3677 'Style','radiobutton', ...
wolffd@0 3678 'Tag','Radiobutton6');
wolffd@0 3679
wolffd@0 3680 data.max_h=h1;
wolffd@0 3681
wolffd@0 3682 h1 = uicontrol('Parent',h0, ...
wolffd@0 3683 'Units','normalized', ...
wolffd@0 3684 'Callback','preprocess window_cb min',...
wolffd@0 3685 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3686 'ListboxTop',0, ...
wolffd@0 3687 'Position',[0.3784722222222222 0.2374429223744292 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3688 'Style','radiobutton', ...
wolffd@0 3689 'Tag','Radiobutton7');
wolffd@0 3690
wolffd@0 3691 data.min_h = h1;
wolffd@0 3692
wolffd@0 3693 h1 = uicontrol('Parent',h0, ...
wolffd@0 3694 'Units','normalized', ...
wolffd@0 3695 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3696 'Callback','preprocess window_cb clip',...
wolffd@0 3697 'ListboxTop',0, ...
wolffd@0 3698 'Position',[0.6909722222222222 0.5525114155251141 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3699 'Style','radiobutton', ...
wolffd@0 3700 'Tag','Radiobutton8');
wolffd@0 3701
wolffd@0 3702 data.clip_h=h1;
wolffd@0 3703 data.eval_mode='clip';
wolffd@0 3704
wolffd@0 3705 h1 = uicontrol('Parent',h0, ...
wolffd@0 3706 'Units','normalized', ...
wolffd@0 3707 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3708 'Callback','preprocess window_cb expand',...
wolffd@0 3709 'ListboxTop',0, ...
wolffd@0 3710 'Position',[0.6909722222222222 0.2922374429223744 0.06597222222222222 0.0821917808219178], ...
wolffd@0 3711 'Style','radiobutton', ...
wolffd@0 3712 'Tag','Radiobutton9');
wolffd@0 3713
wolffd@0 3714 data.expand_h=h1;
wolffd@0 3715
wolffd@0 3716 h1 = uicontrol('Parent',h0, ...
wolffd@0 3717 'Units','normalized', ...
wolffd@0 3718 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3719 'FontWeight','demi', ...
wolffd@0 3720 'FontSize',8,...
wolffd@0 3721 'HorizontalAlignment','left', ...
wolffd@0 3722 'ListboxTop',0, ...
wolffd@0 3723 'Position',[0.132 0.5799 0.19 0.0548], ...
wolffd@0 3724 'String','Centered', ...
wolffd@0 3725 'Style','text', ...
wolffd@0 3726 'Tag','StaticText2');
wolffd@0 3727 h1 = uicontrol('Parent',h0, ...
wolffd@0 3728 'Units','normalized', ...
wolffd@0 3729 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3730 'FontWeight','demi', ...
wolffd@0 3731 'FontSize',8,...
wolffd@0 3732 'HorizontalAlignment','left', ...
wolffd@0 3733 'ListboxTop',0, ...
wolffd@0 3734 'Position',[0.132 0.4247 0.1667 0.0548], ...
wolffd@0 3735 'String','Previous', ...
wolffd@0 3736 'Style','text', ...
wolffd@0 3737 'Tag','StaticText3');
wolffd@0 3738 h1 = uicontrol('Parent',h0, ...
wolffd@0 3739 'Units','normalized', ...
wolffd@0 3740 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3741 'FontWeight','demi', ...
wolffd@0 3742 'FontSize',8,...
wolffd@0 3743 'HorizontalAlignment','left', ...
wolffd@0 3744 'ListboxTop',0, ...
wolffd@0 3745 'Position',[0.132 0.2648 0.1632 0.0548], ...
wolffd@0 3746 'String','Next', ...
wolffd@0 3747 'Style','text', ...
wolffd@0 3748 'Tag','StaticText4');
wolffd@0 3749 h1 = uicontrol('Parent',h0, ...,
wolffd@0 3750 'Units','normalized', ...
wolffd@0 3751 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3752 'FontWeight','demi', ...
wolffd@0 3753 'FontSize',8,...
wolffd@0 3754 'HorizontalAlignment','left', ...
wolffd@0 3755 'ListboxTop',0, ...
wolffd@0 3756 'Position',[0.445 0.6027397260273972 0.19 0.0547945205479452], ...
wolffd@0 3757 'String','Mean', ...
wolffd@0 3758 'Style','text', ...
wolffd@0 3759 'Tag','StaticText5');
wolffd@0 3760 h1 = uicontrol('Parent',h0, ...
wolffd@0 3761 'Units','normalized', ...
wolffd@0 3762 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3763 'FontWeight','demi', ...
wolffd@0 3764 'FontSize',8,...
wolffd@0 3765 'HorizontalAlignment','left', ...
wolffd@0 3766 'ListboxTop',0, ...
wolffd@0 3767 'Position',[0.445 0.4795 0.1806 0.0548], ...
wolffd@0 3768 'String','Median', ...
wolffd@0 3769 'Style','text', ...
wolffd@0 3770 'Tag','StaticText6');
wolffd@0 3771
wolffd@0 3772 h1 = uicontrol('Parent',h0, ...
wolffd@0 3773 'Units','normalized', ...
wolffd@0 3774 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3775 'FontWeight','demi', ...
wolffd@0 3776 'FontSize',8,...
wolffd@0 3777 'HorizontalAlignment','left', ...
wolffd@0 3778 'ListboxTop',0, ...
wolffd@0 3779 'Position',[0.445 0.3699 0.1667 0.0548], ...
wolffd@0 3780 'String','Max', ...
wolffd@0 3781 'Style','text', ...
wolffd@0 3782 'Tag','StaticText7');
wolffd@0 3783 h1 = uicontrol('Parent',h0, ...
wolffd@0 3784 'Units','normalized', ...
wolffd@0 3785 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3786 'FontWeight','demi', ...
wolffd@0 3787 'FontSize',8,...
wolffd@0 3788 'HorizontalAlignment','left', ...
wolffd@0 3789 'ListboxTop',0, ...
wolffd@0 3790 'Position',[0.445 0.2557077625570776 0.1597222222222222 0.0547945205479452], ...
wolffd@0 3791 'String','Min', ...
wolffd@0 3792 'Style','text', ...
wolffd@0 3793 'Tag','StaticText8');
wolffd@0 3794 h1 = uicontrol('Parent',h0, ...
wolffd@0 3795 'Units','normalized', ...
wolffd@0 3796 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3797 'FontWeight','demi', ...
wolffd@0 3798 'FontSize',8,...
wolffd@0 3799 'HorizontalAlignment','left', ...
wolffd@0 3800 'ListboxTop',0, ...
wolffd@0 3801 'Position',[0.7535 0.5753 0.1354 0.054], ...
wolffd@0 3802 'String','Clip', ...
wolffd@0 3803 'Style','text', ...
wolffd@0 3804 'Tag','StaticText9');
wolffd@0 3805 h1 = uicontrol('Parent',h0, ...
wolffd@0 3806 'Units','normalized', ...
wolffd@0 3807 'BackgroundColor',[0.8 0.8 0.8], ...
wolffd@0 3808 'FontWeight','demi', ...
wolffd@0 3809 'FontSize',8,...
wolffd@0 3810 'HorizontalAlignment','left', ...
wolffd@0 3811 'ListboxTop',0, ...
wolffd@0 3812 'Position',[0.7534722222222222 0.3150684931506849 0.1527777777777778 0.0547945205479452], ...
wolffd@0 3813 'String','Expand', ...
wolffd@0 3814 'Style','text', ...
wolffd@0 3815 'Tag','StaticText10');
wolffd@0 3816
wolffd@0 3817
wolffd@0 3818
wolffd@0 3819 set(gcf,'UserData',data);
wolffd@0 3820
wolffd@0 3821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3822
wolffd@0 3823 function window_cb(arg)
wolffd@0 3824
wolffd@0 3825 data=get(gcf,'UserData');
wolffd@0 3826
wolffd@0 3827 if any(strcmp(arg,[{'centered'},{'previous'},{'next'}]))
wolffd@0 3828 switch arg
wolffd@0 3829 case 'centered'
wolffd@0 3830 data.position='center';
wolffd@0 3831 set(data.previous_h,'Value',0);
wolffd@0 3832 set(data.next_h,'Value',0);
wolffd@0 3833 set(data.centered_h,'Value',1);
wolffd@0 3834 case 'previous'
wolffd@0 3835 data.position='previous';
wolffd@0 3836 set(data.centered_h,'Value',0);
wolffd@0 3837 set(data.next_h,'Value',0);
wolffd@0 3838 set(data.previous_h,'Value',1);
wolffd@0 3839 case 'next'
wolffd@0 3840 data.position='next';
wolffd@0 3841 set(data.centered_h,'Value',0);
wolffd@0 3842 set(data.previous_h,'Value',0);
wolffd@0 3843 set(data.next_h,'Value',1);
wolffd@0 3844 end
wolffd@0 3845 elseif any(strcmp(arg,[{'mean'},{'median'},{'min'},{'max'}]))
wolffd@0 3846 switch arg
wolffd@0 3847 case 'mean'
wolffd@0 3848 data.mode='mean';
wolffd@0 3849 set(data.median_h,'Value',0);
wolffd@0 3850 set(data.min_h,'Value',0);
wolffd@0 3851 set(data.max_h,'Value',0);
wolffd@0 3852 set(data.mean_h,'Value',1);
wolffd@0 3853 case 'median'
wolffd@0 3854 data.mode='median';
wolffd@0 3855 set(data.mean_h,'Value',0);
wolffd@0 3856 set(data.max_h,'Value',0);
wolffd@0 3857 set(data.min_h,'Value',0);
wolffd@0 3858 set(data.median_h,'Value',1);
wolffd@0 3859 case 'max'
wolffd@0 3860 data.mode='max';
wolffd@0 3861 set(data.mean_h,'Value',0);
wolffd@0 3862 set(data.median_h,'Value',0);
wolffd@0 3863 set(data.min_h,'Value',0);
wolffd@0 3864 set(data.max_h,'Value',1);
wolffd@0 3865 case 'min'
wolffd@0 3866 data.mode='min';
wolffd@0 3867 set(data.mean_h,'Value',0);
wolffd@0 3868 set(data.median_h,'Value',0);
wolffd@0 3869 set(data.max_h,'Value',0);
wolffd@0 3870 set(data.min_h,'Value',1);
wolffd@0 3871 end
wolffd@0 3872 elseif any(strcmp(arg,[{'clip','expand'}]))
wolffd@0 3873 switch arg
wolffd@0 3874 case 'clip'
wolffd@0 3875 data.eval_mode='clip';
wolffd@0 3876 set(data.expand_h,'Value',0);
wolffd@0 3877 set(data.clip_h,'Value',1);
wolffd@0 3878 case 'expand'
wolffd@0 3879 data.eval_mode='expand';
wolffd@0 3880 set(data.clip_h,'Value',0);
wolffd@0 3881 set(data.expand_h,'Value',1);
wolffd@0 3882 end
wolffd@0 3883 end
wolffd@0 3884
wolffd@0 3885 set(gcf,'UserData',data);
wolffd@0 3886
wolffd@0 3887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 3888
wolffd@0 3889 function eval_windowed(varargin)
wolffd@0 3890
wolffd@0 3891 if nargin == 1
wolffd@0 3892 LOG=1;
wolffd@0 3893 i=1;
wolffd@0 3894 arg=varargin{1};
wolffd@0 3895 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 3896 i=i+1;
wolffd@0 3897 end
wolffd@0 3898 value=str2num(arg(1:i-1));
wolffd@0 3899 i=i+1;
wolffd@0 3900 j=i;
wolffd@0 3901 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 3902 i=i+1;
wolffd@0 3903 end
wolffd@0 3904 position=arg(j:i-1);
wolffd@0 3905 i=i+1;
wolffd@0 3906 j=i;
wolffd@0 3907 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 3908 i=i+1;
wolffd@0 3909 end
wolffd@0 3910 mode=arg(j:i-1);
wolffd@0 3911 i=i+1;
wolffd@0 3912 j=i;
wolffd@0 3913 while i <= length(arg) & arg(i) ~= ' '
wolffd@0 3914 i=i+1;
wolffd@0 3915 end
wolffd@0 3916 eval_mode=arg(j:i-1);
wolffd@0 3917 else
wolffd@0 3918 LOG=0;
wolffd@0 3919 end
wolffd@0 3920
wolffd@0 3921 data=get(gcf,'UserData');
wolffd@0 3922 if LOG
wolffd@0 3923 data.position=position;
wolffd@0 3924 data.eval_mode=eval_mode;
wolffd@0 3925 data.mode=mode;
wolffd@0 3926 end
wolffd@0 3927 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 3928
wolffd@0 3929 if isempty(pre_h)
wolffd@0 3930 errordlg('''Preprocess''-window does not exist. Terminating program...');
wolffd@0 3931 pro_tools('close');
wolffd@0 3932 return;
wolffd@0 3933 end
wolffd@0 3934
wolffd@0 3935 comp_names_h=getfield(get(pre_h,'UserData'),'comp_names_h');
wolffd@0 3936 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 3937 undo=sData;
wolffd@0 3938
wolffd@0 3939 if isempty(get(comp_names_h,'Value'))
wolffd@0 3940 errordlg('There are not components chosen.');
wolffd@0 3941 return;
wolffd@0 3942 end
wolffd@0 3943
wolffd@0 3944 if ~LOG
wolffd@0 3945 if isempty(get(data.win_len_h,'String'))
wolffd@0 3946 errordlg('Window length must be defined');
wolffd@0 3947 return;
wolffd@0 3948 end
wolffd@0 3949
wolffd@0 3950 value=str2num(get(data.win_len_h,'String'));
wolffd@0 3951 end
wolffd@0 3952
wolffd@0 3953 set(data.win_len_h,'String','');
wolffd@0 3954
wolffd@0 3955 if ~LOG
wolffd@0 3956 if isempty(value) | value < 0 | value ~= round(value)
wolffd@0 3957 errordlg('Window length must be positive integer.');
wolffd@0 3958 return;
wolffd@0 3959 end
wolffd@0 3960
wolffd@0 3961 if value > length(sData.data(:,1))
wolffd@0 3962 errordlg('Length of window is too big.');
wolffd@0 3963 return;
wolffd@0 3964 end
wolffd@0 3965 end
wolffd@0 3966
wolffd@0 3967 index=getfield(get_indices,{1});
wolffd@0 3968
wolffd@0 3969 sData=eval_operation(sData,value,data.mode,data.eval_mode,data.position,index);
wolffd@0 3970 sData.comp_norm(index)={[]};
wolffd@0 3971 u_data=get(pre_h,'UserData');
wolffd@0 3972 u_data.sData=sData;
wolffd@0 3973 u_data.undo.sData=undo;
wolffd@0 3974 u_data.undo.selected=u_data.selected_vects;
wolffd@0 3975
wolffd@0 3976 if ~LOG
wolffd@0 3977 u_data.LOG{length(u_data.LOG)+1}=...
wolffd@0 3978 '% Evaluating the wanted ''windowed'' -operation.';
wolffd@0 3979 u_data.LOG{length(u_data.LOG)+1}=cat(2,'preprocess(''eval_windowed'',',...
wolffd@0 3980 '''',num2str(value),...
wolffd@0 3981 ' ',data.position,' ',data.mode,...
wolffd@0 3982 ' ',data.eval_mode,''');');
wolffd@0 3983 end
wolffd@0 3984
wolffd@0 3985 set(pre_h,'UserData',u_data);
wolffd@0 3986 old=gcf;
wolffd@0 3987 set(0,'CurrentFigure',pre_h);
wolffd@0 3988
wolffd@0 3989 if strcmp(data.eval_mode,'expand');
wolffd@0 3990 write_sD_stats;
wolffd@0 3991 pro_tools('selall');
wolffd@0 3992 else
wolffd@0 3993 sel_comp;
wolffd@0 3994 cplot_mimema;
wolffd@0 3995 end
wolffd@0 3996
wolffd@0 3997 set(0,'CurrentFigure',old);
wolffd@0 3998
wolffd@0 3999
wolffd@0 4000
wolffd@0 4001 %%% Subfunction: eval_operation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4002
wolffd@0 4003
wolffd@0 4004 function sData=eval_operation(sData,winlen,mode,evalmode,position,n)
wolffd@0 4005
wolffd@0 4006
wolffd@0 4007 len=length(sData.data(:,1));
wolffd@0 4008 dim=length(sData.data(1,:));
wolffd@0 4009
wolffd@0 4010 switch(position)
wolffd@0 4011 case 'center'
wolffd@0 4012 prev=round(winlen/2)-1;
wolffd@0 4013 next=winlen-round(winlen/2);
wolffd@0 4014 case 'previous'
wolffd@0 4015 prev=winlen-1;
wolffd@0 4016 next=0;
wolffd@0 4017 case 'next'
wolffd@0 4018 prev=0;
wolffd@0 4019 next=winlen-1;
wolffd@0 4020 end
wolffd@0 4021
wolffd@0 4022 switch(evalmode)
wolffd@0 4023 case 'clip'
wolffd@0 4024 for center=1:len
wolffd@0 4025 win=center-prev:center-prev+winlen-1;
wolffd@0 4026 win=win(find(win > 0 & win <= len));
wolffd@0 4027 str=cat(2,mode,'(sData.data(win(find(~isnan(sData.data(win,n)))),n))');
wolffd@0 4028 tmp(center)=eval(str);
wolffd@0 4029 end
wolffd@0 4030 sData.data(:,n)=tmp;
wolffd@0 4031 case 'expand'
wolffd@0 4032 for i=1:len+winlen-1
wolffd@0 4033 win=i-(winlen-1):i;
wolffd@0 4034 win=win(find(win > 0 & win <= len));
wolffd@0 4035 str=cat(2,mode,'(sData.data(win(find(~isnan(sData.data(win,n)))),n))');
wolffd@0 4036 tmp(i)=eval(str);
wolffd@0 4037 end
wolffd@0 4038 sData.data=cat(1,repmat(NaN,next,dim),sData.data,repmat(NaN,prev,dim));
wolffd@0 4039 sData.data(:,n)=tmp;
wolffd@0 4040 end
wolffd@0 4041
wolffd@0 4042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4043
wolffd@0 4044
wolffd@0 4045
wolffd@0 4046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4047
wolffd@0 4048 function pro_tools(arg)
wolffd@0 4049
wolffd@0 4050 switch arg
wolffd@0 4051 case 'close'
wolffd@0 4052 close_preprocess;
wolffd@0 4053 case 'c_stat'
wolffd@0 4054 write_c_stats;
wolffd@0 4055 case 'plot_hist'
wolffd@0 4056 plot_hist;
wolffd@0 4057 case 'plot'
wolffd@0 4058 plot_button;
wolffd@0 4059 case 'plxy'
wolffd@0 4060 plxy_button;
wolffd@0 4061 case 'bplo'
wolffd@0 4062 bplo_button;
wolffd@0 4063 case 'hist'
wolffd@0 4064 hist_button;
wolffd@0 4065 end
wolffd@0 4066
wolffd@0 4067
wolffd@0 4068 %%% Subfunction close_preprocess %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4069
wolffd@0 4070 function close_preprocess
wolffd@0 4071
wolffd@0 4072
wolffd@0 4073 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 4074 man_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 4075 clip_h=findobj(get(0,'Children'),'Tag','Clipping');
wolffd@0 4076 plot_h=findobj(get(0,'Children'),'Tag','PlotWin');
wolffd@0 4077 delay_h=findobj(get(0,'Children'),'Tag','Delay');
wolffd@0 4078 window_h=findobj(get(0,'Children'),'Tag','Window');
wolffd@0 4079 sel_h=findobj(get(0,'Children'),'Tag','Select');
wolffd@0 4080
wolffd@0 4081 if ~isempty(man_h)
wolffd@0 4082 close(man_h);
wolffd@0 4083 end
wolffd@0 4084 if ~isempty(clip_h)
wolffd@0 4085 close(clip_h);
wolffd@0 4086 end
wolffd@0 4087 if ~isempty(plot_h)
wolffd@0 4088 close(plot_h);
wolffd@0 4089 end
wolffd@0 4090 if ~isempty(delay_h)
wolffd@0 4091 close(delay_h);
wolffd@0 4092 end
wolffd@0 4093 if ~isempty(window_h)
wolffd@0 4094 close(window_h);
wolffd@0 4095 end
wolffd@0 4096 if ~isempty(sel_h)
wolffd@0 4097 close(sel_h);
wolffd@0 4098 end
wolffd@0 4099 if ~isempty(pre_h)
wolffd@0 4100 close(pre_h);
wolffd@0 4101 end
wolffd@0 4102
wolffd@0 4103
wolffd@0 4104
wolffd@0 4105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4106
wolffd@0 4107 %%% Subfunction: undo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4108
wolffd@0 4109 function undo(varargin)
wolffd@0 4110
wolffd@0 4111 if nargin == 1
wolffd@0 4112 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 4113 set(0,'CurrentFigure',pre_h);
wolffd@0 4114 LOG=1;
wolffd@0 4115 else
wolffd@0 4116 LOG=0;
wolffd@0 4117 end
wolffd@0 4118
wolffd@0 4119 data=get(gcf,'UserData');
wolffd@0 4120 if ~isempty(data.undo)
wolffd@0 4121 if any(strcmp('selected',fieldnames(data.undo)))
wolffd@0 4122 data.selected_vects=data.undo.selected;
wolffd@0 4123 end
wolffd@0 4124 if ~any(strcmp('index',fieldnames(data.undo)))
wolffd@0 4125 data.sData=data.undo.sData;
wolffd@0 4126 data.undo=[];
wolffd@0 4127 if ~LOG
wolffd@0 4128 data.LOG{length(data.LOG)+1}='% Undo the most recent operation.';
wolffd@0 4129 data.LOG{length(data.LOG)+1}='preprocess(''undo'',''foo'');';
wolffd@0 4130 end
wolffd@0 4131 set(gcf,'UserData',data);
wolffd@0 4132 set_compnames(data.sData,data.comp_names_h);
wolffd@0 4133 write_sD_stats;
wolffd@0 4134 vect_means(data.sData,data.vect_mean_h,data.selected_vects);
wolffd@0 4135 sel_comp;
wolffd@0 4136 cplot_mimema;
wolffd@0 4137 return;
wolffd@0 4138 end
wolffd@0 4139
wolffd@0 4140 % 'undo.sData' does not exist in sD_set - array
wolffd@0 4141
wolffd@0 4142 index=data.undo.index;
wolffd@0 4143 data.undo.sData=rmfield(data.undo.sData,[{'INDEX'};{'MODIFIED'}]);
wolffd@0 4144 if index<=length(data.sD_set)
wolffd@0 4145 rest=data.sD_set(index:length(data.sD_set));
wolffd@0 4146 else
wolffd@0 4147 rest=[];
wolffd@0 4148 end
wolffd@0 4149 data.sD_set=cat(2,data.sD_set(1:index-1),data.undo.sData,rest);
wolffd@0 4150 data.undo=[];
wolffd@0 4151 if ~LOG
wolffd@0 4152 data.LOG{length(data.LOG)+1}='% Undo the most recent operation.';
wolffd@0 4153 data.LOG{length(data.LOG)+1}='preprocess(''undo'',''foo'');';
wolffd@0 4154 end
wolffd@0 4155 set(gcf,'UserData',data);
wolffd@0 4156 set(getfield(get(gcf,'UserData'),'sD_set_h'),'Value',index);
wolffd@0 4157 set_sD_stats;
wolffd@0 4158 sel_sD;
wolffd@0 4159 else
wolffd@0 4160 msgbox('Can''t do...');
wolffd@0 4161 end
wolffd@0 4162
wolffd@0 4163 %%% Subfunction: write_c_stats %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4164
wolffd@0 4165 function write_c_stats(varargin)
wolffd@0 4166
wolffd@0 4167
wolffd@0 4168 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 4169 comp_names_h=getfield(get(pre_h,'UserData'),'comp_names_h');
wolffd@0 4170 sel_comp_h=getfield(get(pre_h,'UserData'),'sel_comp_h');
wolffd@0 4171 sel_chist_h=getfield(get(pre_h,'UserData'),'sel_chist_h');
wolffd@0 4172
wolffd@0 4173 if nargin==1
wolffd@0 4174 val1=varargin(1);
wolffd@0 4175 else
wolffd@0 4176 val1=get(sel_comp_h,'String');
wolffd@0 4177 end
wolffd@0 4178
wolffd@0 4179 if ~isempty(val1) & iscell(val1)
wolffd@0 4180 selected_vects=getfield(get(pre_h,'UserData'),'selected_vects');
wolffd@0 4181 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 4182 sel_cdata_h=getfield(get(pre_h,'UserData'),'sel_cdata_h');
wolffd@0 4183 name=getfield(get(sel_comp_h,'String'),{get(sel_comp_h,'Value')});
wolffd@0 4184 name=name{1};
wolffd@0 4185 i=2;
wolffd@0 4186
wolffd@0 4187 while ~isempty(str2num(name(i)))
wolffd@0 4188 value(i-1)=name(i);
wolffd@0 4189 i=i+1;
wolffd@0 4190 end
wolffd@0 4191
wolffd@0 4192 value=str2num(value);
wolffd@0 4193
wolffd@0 4194
wolffd@0 4195 data=sData.data(selected_vects,value);
wolffd@0 4196
wolffd@0 4197 string{1} = cat(2,'Min: ',sprintf('%-10.3g',min(data)));
wolffd@0 4198 string{2} = cat(2,'Mean: ',sprintf('%-10.3g',mean(data(find(~isnan(data))))));
wolffd@0 4199 string{3} = cat(2,'Max: ',sprintf('%-10.3g',max(data)));
wolffd@0 4200 string{4} = cat(2,'Std: ',sprintf('%-10.3g',std(data(find(~isnan(data))))));
wolffd@0 4201 string{5} = cat(2,'Number of NaNs: ',sprintf('%-10.3g',sum(isnan(data))));
wolffd@0 4202 string{6} = cat(2,'NaN (%):',...
wolffd@0 4203 sprintf('%-10.3g',100*sum(isnan(data))/length(data)));
wolffd@0 4204 string{7} = cat(2,'Number of values: ',sprintf('%-10.3g',...
wolffd@0 4205 length(find(~isnan(unique(data))))));
wolffd@0 4206 set(sel_cdata_h,'String',string);
wolffd@0 4207 set(sel_cdata_h,'HorizontalAlignment','left');
wolffd@0 4208 end
wolffd@0 4209
wolffd@0 4210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4211
wolffd@0 4212 %%% Subfunction plot_hist %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4213
wolffd@0 4214 function plot_hist
wolffd@0 4215
wolffd@0 4216 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 4217 sel_chist_h=getfield(get(pre_h,'UserData'),'sel_chist_h');
wolffd@0 4218 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 4219 selected=getfield(get(pre_h,'UserData'),'selected_vects');
wolffd@0 4220
wolffd@0 4221 value=get(getfield(get(pre_h,'UserData'),'sel_comp_h'),'Value');
wolffd@0 4222 subplot(sel_chist_h);
wolffd@0 4223 hold off;
wolffd@0 4224 cla;
wolffd@0 4225 if all(isnan(sData.data(:,value)));
wolffd@0 4226 return;
wolffd@0 4227 end
wolffd@0 4228 hold on;
wolffd@0 4229 lim1=min(sData.data(:,value));
wolffd@0 4230 lim2=max(sData.data(:,value));
wolffd@0 4231 if lim2 - lim1 >= eps
wolffd@0 4232 x=lim1:(lim2-lim1)/(30-1):lim2;
wolffd@0 4233 set(sel_chist_h,'XLim',[lim1 lim2]);
wolffd@0 4234 elseif lim1 ~= 0
wolffd@0 4235 x=(lim1)/2:lim1/(30-1):lim1+(lim1)/2;
wolffd@0 4236 set(sel_chist_h,'Xlim',[lim1-abs(lim1/2) lim1+abs(lim1/2)]);
wolffd@0 4237 else
wolffd@0 4238 x=-1:2/(30-1):1;
wolffd@0 4239 set(sel_chist_h,'XLim',[-1 1]);
wolffd@0 4240 end
wolffd@0 4241
wolffd@0 4242 hist(sData.data(selected,value),x);
wolffd@0 4243
wolffd@0 4244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4245
wolffd@0 4246 %%% Subfunction: select_all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4247
wolffd@0 4248 function select_all(varargin)
wolffd@0 4249
wolffd@0 4250 if nargin == 1
wolffd@0 4251 LOG=1;
wolffd@0 4252 else
wolffd@0 4253 LOG=0;
wolffd@0 4254 end
wolffd@0 4255
wolffd@0 4256 data=get(gcf,'UserData');
wolffd@0 4257 data.selected_vects=(1:length(data.sData.data(:,1)));
wolffd@0 4258 if ~LOG
wolffd@0 4259 data.LOG{length(data.LOG)+1}='% Select all vectors.';
wolffd@0 4260 data.LOG{length(data.LOG)+1}='selall(''foo'');';
wolffd@0 4261 end
wolffd@0 4262 set(gcf,'UserData',data);
wolffd@0 4263 tmp=zeros(1,length(data.sData.data(:,1)));
wolffd@0 4264 tmp(data.selected_vects)=1;
wolffd@0 4265 draw_vectors(tmp,data.vector_h);
wolffd@0 4266 cplot_mimema;
wolffd@0 4267 vect_means(data.sData,data.vect_mean_h,data.selected_vects);
wolffd@0 4268 sel_comp;
wolffd@0 4269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4270
wolffd@0 4271 %%% Subfunction: plot_button %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4272
wolffd@0 4273 function plot_button
wolffd@0 4274
wolffd@0 4275 %PLOT_BUTTON A callback function. Plots all the components and marks
wolffd@0 4276 % the chosen components.
wolffd@0 4277 %
wolffd@0 4278 %
wolffd@0 4279
wolffd@0 4280 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 4281 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 4282
wolffd@0 4283 indices=get_indices;
wolffd@0 4284 if isempty(indices)
wolffd@0 4285 return;
wolffd@0 4286 end
wolffd@0 4287 h=findobj(get(0,'Children'),'Tag','PlotWin');
wolffd@0 4288 if isempty(h)
wolffd@0 4289 h= figure;
wolffd@0 4290 set(h,'Tag','PlotWin');
wolffd@0 4291 end
wolffd@0 4292
wolffd@0 4293 names=sData.comp_names(indices);
wolffd@0 4294 data=sData.data(:,indices);
wolffd@0 4295
wolffd@0 4296 set(0,'CurrentFigure',h);
wolffd@0 4297 hold off;
wolffd@0 4298 clf;
wolffd@0 4299 t=0:1/(getfield(size(data),{1})-1):1;
wolffd@0 4300 tmp=setdiff(1:length(data(:,1)),selected);
wolffd@0 4301 for i=1:length(names)
wolffd@0 4302 subplot(length(names),1,i);
wolffd@0 4303 hold on;
wolffd@0 4304 if max(data(:,i))- min(data(:,i)) <= eps
wolffd@0 4305 set(gca,'YLim',[max(data(:,i))-1 max(data(:,i))+1]);
wolffd@0 4306 end
wolffd@0 4307 plot(t,data(:,i));
wolffd@0 4308 if ~isempty(tmp);
wolffd@0 4309 data(tmp,i)=NaN;
wolffd@0 4310 end
wolffd@0 4311 plot(t,data(:,i),'red');
wolffd@0 4312 ylabel(names{i});
wolffd@0 4313 set(gca,'XTick',[]);
wolffd@0 4314 end
wolffd@0 4315 set(gcf,'Name','Plotted Data Components');
wolffd@0 4316
wolffd@0 4317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4318
wolffd@0 4319 %%% Subfunction: plxy_button %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4320
wolffd@0 4321 function plxy_button
wolffd@0 4322
wolffd@0 4323 %PLXY_BUTTON A callback function. XY-plots the first and the second
wolffd@0 4324 % components chosen.
wolffd@0 4325 %
wolffd@0 4326 %
wolffd@0 4327
wolffd@0 4328
wolffd@0 4329 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 4330 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 4331
wolffd@0 4332 inds = get_indices;
wolffd@0 4333 if length(inds) < 2
wolffd@0 4334 errordlg('There must be two components chosen for XY-plot.');
wolffd@0 4335 return;
wolffd@0 4336 end
wolffd@0 4337
wolffd@0 4338 inds=inds(1:2);
wolffd@0 4339 names=getfield(sData,'comp_names',{inds});
wolffd@0 4340
wolffd@0 4341 h=findobj(get(0,'Children'),'Tag','PlotWin');
wolffd@0 4342
wolffd@0 4343 if isempty(h)
wolffd@0 4344 h= figure;
wolffd@0 4345 set(h,'Tag','PlotWin');
wolffd@0 4346 end
wolffd@0 4347
wolffd@0 4348 set(0,'CurrentFigure',h);
wolffd@0 4349 clf;
wolffd@0 4350 axes;
wolffd@0 4351 if max(sData.data(:,inds(1))) - min(sData.data(:,inds(1))) <= eps
wolffd@0 4352 set(gca,'XLim',[max(sData.data(:,inds(1)))-1 max(sData.data(:,inds(1)))+1]);
wolffd@0 4353 end
wolffd@0 4354 if max(sData.data(:,inds(2))) - min(sData.data(:,inds(2))) <= eps
wolffd@0 4355 set(gca,'YLim',[max(sData.data(:,inds(2)))-1 max(sData.data(:,inds(2)))+1]);
wolffd@0 4356 end
wolffd@0 4357 hold on;
wolffd@0 4358 plot(sData.data(:,inds(1)),sData.data(:,inds(2)),'o');
wolffd@0 4359 x=sData.data(selected,inds(1));
wolffd@0 4360 y=sData.data(selected,inds(2));
wolffd@0 4361
wolffd@0 4362 plot(x,y,'ored','MarkerSize',4);
wolffd@0 4363 xlabel(names(1));
wolffd@0 4364 ylabel(names(2));
wolffd@0 4365 set(h,'Name','Plotted Data Components');
wolffd@0 4366
wolffd@0 4367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4368
wolffd@0 4369 %%% Sub_function: bplo_button %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4370
wolffd@0 4371 function bplo_button
wolffd@0 4372
wolffd@0 4373 %BPLO_BUTTON A callback function. Box-plots the first component chosen.
wolffd@0 4374
wolffd@0 4375
wolffd@0 4376 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 4377 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 4378
wolffd@0 4379 if length(selected) == 1
wolffd@0 4380 errordlg('There are too few vectors chosen for box-plotting.');
wolffd@0 4381 else
wolffd@0 4382 indices=get_indices;
wolffd@0 4383 if isempty(indices)
wolffd@0 4384 return;
wolffd@0 4385 end
wolffd@0 4386 for i=1:length(indices)
wolffd@0 4387 if length(unique(sData.data(selected,indices(i))))==1
wolffd@0 4388 errordlg('All the values are the same. Operation can''t be evaluated.');
wolffd@0 4389 return;
wolffd@0 4390 end
wolffd@0 4391 end
wolffd@0 4392 names=getfield(sData,'comp_names',{indices});
wolffd@0 4393 h= findobj(get(0,'Children'),'Tag','PlotWin');
wolffd@0 4394 if isempty(h)
wolffd@0 4395 h= figure;
wolffd@0 4396 set(h,'Tag','PlotWin');
wolffd@0 4397 end
wolffd@0 4398
wolffd@0 4399 data=sData.data(selected,indices);
wolffd@0 4400
wolffd@0 4401 set(0,'CurrentFigure',h);
wolffd@0 4402 hold off;
wolffd@0 4403 clf;
wolffd@0 4404 hold on;
wolffd@0 4405 for i=1:getfield(size(data),{2})
wolffd@0 4406 subplot(getfield(size(data),{2}),1,i);
wolffd@0 4407 if ~all(isnan(data(:,i)))
wolffd@0 4408 boxplot(data(:,i));
wolffd@0 4409 end
wolffd@0 4410 name=names{i};
wolffd@0 4411 tmp=get(get(gca,'YLabel'),'String');
wolffd@0 4412 ylabel(cat(2,sprintf('[%s] ',name),tmp));
wolffd@0 4413 end
wolffd@0 4414 set(h,'Name','Box-plot');
wolffd@0 4415 end
wolffd@0 4416
wolffd@0 4417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4418
wolffd@0 4419 %%% Subfunction: hist_button %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4420
wolffd@0 4421 function hist_button
wolffd@0 4422
wolffd@0 4423 no_of_bins_h=getfield(get(gcf,'UserData'),'no_of_bins_h');
wolffd@0 4424 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 4425 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 4426 n=str2num(get(no_of_bins_h,'String'));
wolffd@0 4427 s1='Invalid number of bins.';
wolffd@0 4428 s2=sprintf('\nSet new value to the box under the ''Histogram''-button.');
wolffd@0 4429
wolffd@0 4430 if isempty(n)
wolffd@0 4431 errordlg(cat(2,s1,s2));
wolffd@0 4432 else
wolffd@0 4433 indices=get_indices;
wolffd@0 4434 if isempty(indices)
wolffd@0 4435 return;
wolffd@0 4436 end
wolffd@0 4437 n=round(n);
wolffd@0 4438 if n < 1
wolffd@0 4439 errordlg('Number of bins must be positive integer.');
wolffd@0 4440 else
wolffd@0 4441 h= findobj(get(0,'Children'),'Tag','PlotWin');
wolffd@0 4442 if isempty(h)
wolffd@0 4443 h= figure;
wolffd@0 4444 set(h,'Tag','PlotWin');
wolffd@0 4445 end
wolffd@0 4446
wolffd@0 4447 set(0,'CurrentFigure',h);
wolffd@0 4448 hold off;
wolffd@0 4449 clf;
wolffd@0 4450 data=sData.data(selected,indices);
wolffd@0 4451 names=sData.comp_names(indices);
wolffd@0 4452 for i=1:length(names)
wolffd@0 4453 subplot(length(names),1,i);
wolffd@0 4454 hold on;
wolffd@0 4455 lim1=min(sData.data(:,indices(i)));
wolffd@0 4456 lim2=max(sData.data(:,indices(i)));
wolffd@0 4457 if n > 1
wolffd@0 4458 if lim2 - lim1 >= eps
wolffd@0 4459 x=lim1:(lim2-lim1)/(n-1):lim2;
wolffd@0 4460 set(gca,'XLim',[lim1 lim2]);
wolffd@0 4461 elseif lim1 ~= 0
wolffd@0 4462 x=lim1/2:lim1/(n-1):lim1/2+lim1;
wolffd@0 4463 if ~all(isnan([lim1 lim2]))
wolffd@0 4464 set(gca,'XLim',[lim1-abs(lim1/2) lim1+abs(lim1/2)]);
wolffd@0 4465 end
wolffd@0 4466 else
wolffd@0 4467 x=-1:2/(n-1):1;
wolffd@0 4468 set(gca,'XLim',[-1 1]);
wolffd@0 4469 end
wolffd@0 4470 else
wolffd@0 4471 x=1;
wolffd@0 4472 if lim2 ~= lim1
wolffd@0 4473 set(gca,'XLim',[lim1 lim2]);
wolffd@0 4474 else
wolffd@0 4475 set(gca,'XLim',[lim1/2 lim1/2+lim1]);
wolffd@0 4476 end
wolffd@0 4477 end
wolffd@0 4478 if ~all(isnan(data(:,i)))
wolffd@0 4479 hist(data(:,i),x);
wolffd@0 4480 end
wolffd@0 4481 name=names{i};
wolffd@0 4482 xlabel(name);
wolffd@0 4483 end
wolffd@0 4484 set(h,'Name','Histogram');
wolffd@0 4485 end
wolffd@0 4486 end
wolffd@0 4487
wolffd@0 4488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4489
wolffd@0 4490 %%% Subfunction: no_of_values %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4491
wolffd@0 4492 function no_of_values(varargin);
wolffd@0 4493
wolffd@0 4494 %NO_OF_VALUES A callback function. Calculates the number of different
wolffd@0 4495 % values of the chosen components.
wolffd@0 4496 %
wolffd@0 4497 %
wolffd@0 4498
wolffd@0 4499 if nargin==1;
wolffd@0 4500 LOG=1;
wolffd@0 4501 else
wolffd@0 4502 LOG=0;
wolffd@0 4503 end
wolffd@0 4504
wolffd@0 4505 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 4506 results_h=getfield(get(pre_h,'UserData'),'results_h');
wolffd@0 4507 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 4508 selected=getfield(get(pre_h,'UserData'),'selected_vects');
wolffd@0 4509 str1='There must be one component chosen for ''Number of Values''-operation';
wolffd@0 4510
wolffd@0 4511
wolffd@0 4512 if ~LOG & isempty(get_indices)
wolffd@0 4513 errordlg(str1);
wolffd@0 4514 else
wolffd@0 4515 indices=get_indices;
wolffd@0 4516 data=sData.data(selected,indices);
wolffd@0 4517
wolffd@0 4518 string{1} = 'Number of different values:';
wolffd@0 4519
wolffd@0 4520 for i=1:getfield(size(data),{2})
wolffd@0 4521
wolffd@0 4522 tmp=data(:,i);
wolffd@0 4523 string{i+1}=cat(2,sprintf('#%d:',indices(i)),...
wolffd@0 4524 sprintf('%d',length(find(~isnan(unique(data(:,i)))))));
wolffd@0 4525 end
wolffd@0 4526
wolffd@0 4527 set(results_h,'String',string);
wolffd@0 4528 set(results_h,'HorizontalAlignment','left');
wolffd@0 4529 if ~LOG
wolffd@0 4530 data=get(pre_h,'UserData');
wolffd@0 4531 data.LOG{length(data.LOG)+1}='% Number of values';
wolffd@0 4532 data.LOG{length(data.LOG)+1}='preprocess(''noof'',''foo'');';
wolffd@0 4533 set(pre_h,'UserData',data);
wolffd@0 4534 end
wolffd@0 4535 end
wolffd@0 4536
wolffd@0 4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4538
wolffd@0 4539 %%% Subfunction: correlation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4540
wolffd@0 4541 function correlation(varargin)
wolffd@0 4542
wolffd@0 4543 if nargin == 1
wolffd@0 4544 LOG=1;
wolffd@0 4545 else
wolffd@0 4546 LOG=0;
wolffd@0 4547 end
wolffd@0 4548
wolffd@0 4549 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 4550 results_h=getfield(get(pre_h,'UserData'),'results_h');
wolffd@0 4551 selected=getfield(get(pre_h,'UserData'),'selected_vects');
wolffd@0 4552 sData=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 4553
wolffd@0 4554 if length(get_indices) < 2
wolffd@0 4555 errordlg('There must be two components chosen for Correlation');
wolffd@0 4556 else
wolffd@0 4557 indices=getfield(get_indices,{1:2});
wolffd@0 4558 data=sData.data(selected,indices);
wolffd@0 4559 inds=find(~isnan(data(:,1)) & ~isnan(data(:,2)));
wolffd@0 4560 value=getfield(corrcoef(data(inds,1),data(inds,2)),{1,2});
wolffd@0 4561 names=sData.comp_names(indices);
wolffd@0 4562 string{1}='Correlation between';
wolffd@0 4563 string{2}=cat(2,names{1},' and ',names{2},':');
wolffd@0 4564 string{3}=sprintf('%-10.3g',value);
wolffd@0 4565
wolffd@0 4566 set(results_h,'String',string);
wolffd@0 4567 set(results_h,'HorizontalAlignment','left');
wolffd@0 4568 if ~LOG
wolffd@0 4569 data=get(pre_h,'UserData');
wolffd@0 4570 data.LOG{length(data.LOG)+1}='% Correlation';
wolffd@0 4571 data.LOG{length(data.LOG)+1}='preprocess(''corr'',''foo'');';
wolffd@0 4572 set(pre_h,'UserData',data);
wolffd@0 4573 end
wolffd@0 4574 end
wolffd@0 4575
wolffd@0 4576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4577
wolffd@0 4578 %%% Subfunction: unit_length %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4579
wolffd@0 4580 function unit_length(varargin)
wolffd@0 4581
wolffd@0 4582 %UNIT_LENGTH A callback function Scales all the vectors to the unit
wolffd@0 4583 % length.
wolffd@0 4584 %
wolffd@0 4585 %
wolffd@0 4586
wolffd@0 4587 if nargin==1
wolffd@0 4588 LOG=1;
wolffd@0 4589 else
wolffd@0 4590 LOG=0;
wolffd@0 4591 end
wolffd@0 4592
wolffd@0 4593 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 4594 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 4595 sData.MODIFIED=1;
wolffd@0 4596 scaled=sData.data;
wolffd@0 4597 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 4598
wolffd@0 4599 if ~LOG & isempty(get(comp_names_h,'Value'))
wolffd@0 4600 errordlg('There must be components chosen for the ''unit length''- operation');
wolffd@0 4601 return;
wolffd@0 4602 end
wolffd@0 4603 inds=get_indices;
wolffd@0 4604 for i=1:length(scaled(:,1));
wolffd@0 4605 x=find(~isnan(scaled(i,inds)));
wolffd@0 4606 scaled(i,inds(x))=(1/sqrt(sum(scaled(i,inds(x)).^2)))*scaled(i,inds(x));
wolffd@0 4607 end
wolffd@0 4608
wolffd@0 4609 data=get(gcf,'UserData');
wolffd@0 4610
wolffd@0 4611
wolffd@0 4612 data.undo.sData = sData;
wolffd@0 4613 data.sData.data=scaled;
wolffd@0 4614
wolffd@0 4615 for i=1:length(inds)
wolffd@0 4616 data.sData.comp_norm{inds(i)}=[];
wolffd@0 4617 end
wolffd@0 4618
wolffd@0 4619 if ~LOG
wolffd@0 4620 data.LOG{length(data.LOG)+1}='% Unit length';
wolffd@0 4621 data.LOG{length(data.LOG)+1}='preprocess(''unit'',''foo'');';
wolffd@0 4622 end
wolffd@0 4623 set(gcf,'UserData',data);
wolffd@0 4624
wolffd@0 4625 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 4626 vects(data.selected_vects)=1;
wolffd@0 4627
wolffd@0 4628 draw_vectors(vects,data.vector_h);
wolffd@0 4629 vect_means(sData,vect_mean_h,data.selected_vects);
wolffd@0 4630 cplot_mimema;
wolffd@0 4631 plot_hist;
wolffd@0 4632
wolffd@0 4633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4634
wolffd@0 4635 %%% Subfunction: one_of_n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4636
wolffd@0 4637 function one_of_n(varargin)
wolffd@0 4638
wolffd@0 4639 if nargin==1
wolffd@0 4640 LOG=1;
wolffd@0 4641 else
wolffd@0 4642 LOG=0;
wolffd@0 4643 end
wolffd@0 4644
wolffd@0 4645 data=get(gcf,'UserData');
wolffd@0 4646 vector_h=getfield(get(gcf,'Userdata'),'vector_h');
wolffd@0 4647 comp_names_h=getfield(get(gcf,'Userdata'),'comp_names_h');
wolffd@0 4648 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 4649 sData=data.sData;
wolffd@0 4650 undo=data.sData;
wolffd@0 4651 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 4652 msg='Creating over 10 new components. Stop operation?';
wolffd@0 4653
wolffd@0 4654 if ~LOG
wolffd@0 4655 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 4656 errordlg('There must be one component chosen for ''Add: N binary types'' -operation');
wolffd@0 4657 return;
wolffd@0 4658 end
wolffd@0 4659 end
wolffd@0 4660
wolffd@0 4661 index=getfield(get_indices,{1});
wolffd@0 4662
wolffd@0 4663 tmp=unique(sData.data(:,index));
wolffd@0 4664 n=length(tmp);
wolffd@0 4665
wolffd@0 4666 if ~LOG
wolffd@0 4667 if n>10
wolffd@0 4668 answer=questdlg(msg,'Question','Yes','No','Yes');
wolffd@0 4669
wolffd@0 4670 if strcmp(answer,'Yes')
wolffd@0 4671 msgbox('Operation stopped.');
wolffd@0 4672 return;
wolffd@0 4673 end
wolffd@0 4674
wolffd@0 4675 end
wolffd@0 4676 end
wolffd@0 4677
wolffd@0 4678 dim1=getfield(size(sData.data),{1});
wolffd@0 4679 dim2=getfield(size(sData.data),{2});
wolffd@0 4680 sData.data=cat(2,sData.data,zeros(dim1,n));
wolffd@0 4681
wolffd@0 4682 dim=dim2+n;
wolffd@0 4683 for i=1:n
wolffd@0 4684 sData.data(:,dim-(n-i))=(sData.data(:,index) == tmp(i));
wolffd@0 4685 end
wolffd@0 4686
wolffd@0 4687 INDEX=sData.INDEX;
wolffd@0 4688 for i=1:n
wolffd@0 4689 sData.comp_names{dim2+i}=sprintf('%dNewVar',dim2+i);
wolffd@0 4690 end
wolffd@0 4691 tmp_norm=cat(1,sData.comp_norm,cell(n,1));
wolffd@0 4692 sData=som_data_struct(sData.data,...
wolffd@0 4693 'name',sData.name,...
wolffd@0 4694 'labels',sData.labels,...
wolffd@0 4695 'comp_names',sData.comp_names);
wolffd@0 4696
wolffd@0 4697 sData.MODIFIED=1;
wolffd@0 4698 sData.INDEX=INDEX;
wolffd@0 4699 sData.comp_norm=tmp_norm;
wolffd@0 4700 data.undo.sData=undo;
wolffd@0 4701 data.sData=sData;
wolffd@0 4702 data.selected_vects=1:length(sData.data(:,1));
wolffd@0 4703 if ~LOG
wolffd@0 4704 data.LOG{length(data.LOG)+1}='% Add: N binary types';
wolffd@0 4705 data.LOG{length(data.LOG)+1}='preprocess(''oneo'',''foo'');';
wolffd@0 4706 end
wolffd@0 4707 set(gcf,'UserData',data);
wolffd@0 4708 clear_button;
wolffd@0 4709 write_sD_stats;
wolffd@0 4710 set_compnames(sData,comp_names_h);
wolffd@0 4711 tmp=ones(1,length(sData.data(:,1)));
wolffd@0 4712 draw_vectors(tmp,vector_h);
wolffd@0 4713 vect_means(sData,vect_mean_h,1:length(sData.data(:,1)));
wolffd@0 4714 cplot_mimema;
wolffd@0 4715 sel_comp;
wolffd@0 4716
wolffd@0 4717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4718
wolffd@0 4719 %%% Subfunction: add_zeros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4720
wolffd@0 4721 function add_zeros(varargin)
wolffd@0 4722
wolffd@0 4723 if nargin == 1
wolffd@0 4724 LOG=1;
wolffd@0 4725 else
wolffd@0 4726 LOG=0;
wolffd@0 4727 end
wolffd@0 4728
wolffd@0 4729 data=get(gcf,'UserData');
wolffd@0 4730 vector_h=getfield(get(gcf,'Userdata'),'vector_h');
wolffd@0 4731 comp_names_h=getfield(get(gcf,'Userdata'),'comp_names_h');
wolffd@0 4732 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 4733 sData=data.sData;
wolffd@0 4734 undo=sData;
wolffd@0 4735
wolffd@0 4736 dim1=getfield(size(sData.data),{1});
wolffd@0 4737 dim2=getfield(size(sData.data),{2});
wolffd@0 4738 sData.data=cat(2,sData.data,zeros(dim1,1));
wolffd@0 4739
wolffd@0 4740 INDEX=sData.INDEX;
wolffd@0 4741
wolffd@0 4742 sData.comp_names{dim2+1}=sprintf('%dNewVar',dim2+1);
wolffd@0 4743 tmp_norm=cat(1,sData.comp_norm,cell(1,1));
wolffd@0 4744 sData=som_data_struct(sData.data,...
wolffd@0 4745 'name',sData.name,...
wolffd@0 4746 'labels',sData.labels,...
wolffd@0 4747 'comp_names',sData.comp_names);
wolffd@0 4748
wolffd@0 4749 sData.MODIFIED=1;
wolffd@0 4750 sData.INDEX=INDEX;
wolffd@0 4751 sData.comp_norm=tmp_norm;
wolffd@0 4752 data.sData=sData;
wolffd@0 4753 data.undo.sData=undo;
wolffd@0 4754 data.selected_vects=1:length(sData.data(:,1));
wolffd@0 4755 if ~LOG
wolffd@0 4756 data.LOG{length(data.LOG)+1}='% Add: zeros';
wolffd@0 4757 data.LOG{length(data.LOG)+1}='preprocess(''zero'',''foo'');';
wolffd@0 4758 end
wolffd@0 4759 set(gcf,'UserData',data);
wolffd@0 4760 clear_button;
wolffd@0 4761 write_sD_stats;
wolffd@0 4762 set_compnames(sData,comp_names_h);
wolffd@0 4763 tmp=ones(1,length(sData.data(:,1)));
wolffd@0 4764 draw_vectors(tmp,vector_h);
wolffd@0 4765 vect_means(sData,vect_mean_h,1:length(sData.data(:,1)));
wolffd@0 4766 cplot_mimema;
wolffd@0 4767 sel_comp;
wolffd@0 4768
wolffd@0 4769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4770
wolffd@0 4771 %%% Subfunction: move_component %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4772
wolffd@0 4773 function move_component(varargin)
wolffd@0 4774
wolffd@0 4775 %MOVE_COMPONENT A callback function. Moves one component of vectors to
wolffd@0 4776 % the position wanted.
wolffd@0 4777 %
wolffd@0 4778 %
wolffd@0 4779
wolffd@0 4780 if nargin == 1
wolffd@0 4781 LOG=1;
wolffd@0 4782 i=1;
wolffd@0 4783 while varargin{1}(i) ~= ' '
wolffd@0 4784 value(i)=varargin{1}(i);
wolffd@0 4785 i=i+1;
wolffd@0 4786 end
wolffd@0 4787 value=str2num(value); % the new place
wolffd@0 4788 index=str2num(varargin{1}(i:length(varargin{1}))); % index of the chosen
wolffd@0 4789 % component
wolffd@0 4790 else
wolffd@0 4791 LOG=0;
wolffd@0 4792 end
wolffd@0 4793
wolffd@0 4794 data=get(gcf,'UserData');
wolffd@0 4795 sData=data.sData;
wolffd@0 4796 undo=sData;
wolffd@0 4797 prompt='Enter the number of the new component place:';
wolffd@0 4798
wolffd@0 4799
wolffd@0 4800 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 4801 errordlg('There must be one component chosen for ''Move Component''-operation');
wolffd@0 4802 return;
wolffd@0 4803 end
wolffd@0 4804
wolffd@0 4805 if ~LOG
wolffd@0 4806 index=getfield(get_indices,{1});
wolffd@0 4807 answer=inputdlg(prompt);
wolffd@0 4808
wolffd@0 4809 if isempty(answer) | (iscell(answer) & isempty(answer{1}))
wolffd@0 4810 msgbox('No components moved');
wolffd@0 4811 return;
wolffd@0 4812 end
wolffd@0 4813
wolffd@0 4814 value=str2num(answer{1});
wolffd@0 4815
wolffd@0 4816
wolffd@0 4817 dims=size(value);
wolffd@0 4818
wolffd@0 4819 if dims(1) ~= 1 | dims(2) ~= 1 | ~isreal(value)
wolffd@0 4820 errordlg('The new component place must be positive integer.')
wolffd@0 4821 return;
wolffd@0 4822 end
wolffd@0 4823
wolffd@0 4824 if value <= 0 | round(value) ~= value
wolffd@0 4825 errordlg('The new component place must be positive integer.');
wolffd@0 4826 return;
wolffd@0 4827 end
wolffd@0 4828
wolffd@0 4829 if value > getfield(size(sData.data),{2})
wolffd@0 4830 errordlg('Too big value for the new component place.');
wolffd@0 4831 return;
wolffd@0 4832 end
wolffd@0 4833 end
wolffd@0 4834
wolffd@0 4835 sData.MODIFIED=1;
wolffd@0 4836 if index < value
wolffd@0 4837 indices1=setdiff(1:value,index);
wolffd@0 4838 indices2=setdiff(value+1:length(sData.data(1,:)),index);
wolffd@0 4839 elseif index > value
wolffd@0 4840 indices1=setdiff(1:value-1,index);
wolffd@0 4841 indices2=setdiff(value:length(sData.data(1,:)),index);
wolffd@0 4842 else
wolffd@0 4843 data.sData=sData;
wolffd@0 4844 data.undo.sData=undo;
wolffd@0 4845 set(gcf,'UserData',data);
wolffd@0 4846 return;
wolffd@0 4847 end
wolffd@0 4848
wolffd@0 4849 tmp1=sData.data(:,indices1);
wolffd@0 4850 tmp2=sData.data(:,indices2);
wolffd@0 4851 sData.data=cat(2,tmp1,sData.data(:,index),tmp2);
wolffd@0 4852
wolffd@0 4853 tmp1=sData.comp_names(indices1);
wolffd@0 4854 tmp2=sData.comp_names(indices2);
wolffd@0 4855 sData.comp_names=cat(1,tmp1,sData.comp_names(index),tmp2);
wolffd@0 4856
wolffd@0 4857 tmp1=sData.comp_norm(indices1);
wolffd@0 4858 tmp2=sData.comp_norm(indices2);
wolffd@0 4859 sData.comp_norm=cat(1,tmp1,sData.comp_norm(index),tmp2);
wolffd@0 4860
wolffd@0 4861 data.sData=sData;
wolffd@0 4862 data.undo.sData=undo;
wolffd@0 4863 if ~LOG
wolffd@0 4864 data.LOG{length(data.LOG)+1}='% Move component.';
wolffd@0 4865 data.LOG{length(data.LOG)+1}=sprintf('preprocess(''move'',''%s %s'');',...
wolffd@0 4866 num2str(value),num2str(index));
wolffd@0 4867 end
wolffd@0 4868 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 4869 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 4870 vector_h=getfield(get(gcf,'UserData'),'vector_h');
wolffd@0 4871 data.selected_vects=1:length(sData.data(:,1));
wolffd@0 4872 set(gcf,'UserData',data);
wolffd@0 4873 clear_button;
wolffd@0 4874 set_compnames(sData,comp_names_h);
wolffd@0 4875 draw_vectors(ones(1,length(sData.data(:,1))),vector_h);
wolffd@0 4876 vect_means(sData,vect_mean_h,data.selected_vects);
wolffd@0 4877 cplot_mimema;
wolffd@0 4878 sel_comp;
wolffd@0 4879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4880
wolffd@0 4881 %%% Subfunction: copy_component %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4882
wolffd@0 4883 function copy_component(varargin)
wolffd@0 4884
wolffd@0 4885 %COPY_COMPONENT Copies one component of vectors to the position wanted.
wolffd@0 4886 %
wolffd@0 4887 %
wolffd@0 4888
wolffd@0 4889 if nargin == 1
wolffd@0 4890 LOG=1;
wolffd@0 4891 i=1;
wolffd@0 4892 while varargin{1}(i) ~= ' '
wolffd@0 4893 value(i)=varargin{1}(i);
wolffd@0 4894 i=i+1;
wolffd@0 4895 end
wolffd@0 4896 value=str2num(value); % the new place
wolffd@0 4897 index=str2num(varargin{1}(i:length(varargin{1}))); % index of the chosen
wolffd@0 4898 % component
wolffd@0 4899 else
wolffd@0 4900 LOG=0;
wolffd@0 4901 end
wolffd@0 4902
wolffd@0 4903
wolffd@0 4904 data=get(gcf,'UserData');
wolffd@0 4905 sData=data.sData;
wolffd@0 4906 undo=sData;
wolffd@0 4907 if ~LOG
wolffd@0 4908 prompt='Enter the number of the new component place:';
wolffd@0 4909
wolffd@0 4910
wolffd@0 4911 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 4912 errordlg('There must be one component chosen for ''Copy Component''-operation');
wolffd@0 4913 return;
wolffd@0 4914 end
wolffd@0 4915
wolffd@0 4916 index=getfield(get_indices,{1});
wolffd@0 4917 answer=inputdlg(prompt);
wolffd@0 4918
wolffd@0 4919 if isempty(answer) | (iscell(answer) & isempty(answer{1}))
wolffd@0 4920 msgbox('No components moved');
wolffd@0 4921 return
wolffd@0 4922 end
wolffd@0 4923
wolffd@0 4924
wolffd@0 4925 value=str2num(answer{1});
wolffd@0 4926 dims=size(value);
wolffd@0 4927
wolffd@0 4928 if dims(1) ~= 1 | dims(2) ~= 1 | ~isreal(value)
wolffd@0 4929 errordlg('The new component place must be positive integer.')
wolffd@0 4930 return;
wolffd@0 4931 end
wolffd@0 4932
wolffd@0 4933 if value <= 0 | round(value) ~= value
wolffd@0 4934 errordlg('The new component place must be positive integer.');
wolffd@0 4935 return;
wolffd@0 4936 end
wolffd@0 4937
wolffd@0 4938 if value > getfield(size(sData.data),{2}) + 1
wolffd@0 4939 errordlg('Too big value for the new component place.');
wolffd@0 4940 return;
wolffd@0 4941 end
wolffd@0 4942 end
wolffd@0 4943
wolffd@0 4944 sData.MODIFIED=1;
wolffd@0 4945
wolffd@0 4946 indices1=1:value-1;
wolffd@0 4947 indices2=value:length(sData.data(1,:));
wolffd@0 4948 tmp1=sData.data(:,indices1);
wolffd@0 4949 tmp2=sData.data(:,indices2);
wolffd@0 4950 sData.data=cat(2,tmp1,sData.data(:,index),tmp2);
wolffd@0 4951
wolffd@0 4952 tmp1=sData.comp_names(indices1);
wolffd@0 4953 tmp2=sData.comp_names(indices2);
wolffd@0 4954 name=cell(1,1);
wolffd@0 4955 name{1}=cat(2,'Copied',sData.comp_names{index});
wolffd@0 4956 sData.comp_names=cat(1,tmp1,name,tmp2);
wolffd@0 4957
wolffd@0 4958 tmp1=sData.comp_norm(indices1);
wolffd@0 4959 tmp2=sData.comp_norm(indices2);
wolffd@0 4960 norm=cell(1,1);
wolffd@0 4961 norm{1}=sData.comp_norm{index};
wolffd@0 4962 sData.comp_norm=cat(1,tmp1,norm,tmp2);
wolffd@0 4963
wolffd@0 4964 data.sData=sData;
wolffd@0 4965 data.undo.sData=undo;
wolffd@0 4966 if ~LOG
wolffd@0 4967 data.LOG{length(data.LOG)+1}='% Copy component';
wolffd@0 4968 data.LOG{length(data.LOG)+1}=sprintf('preprocess(''copy'',''%s %s'');',...
wolffd@0 4969 num2str(value),num2str(index));
wolffd@0 4970 end
wolffd@0 4971
wolffd@0 4972
wolffd@0 4973 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 4974 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 4975 vector_h=getfield(get(gcf,'UserData'),'vector_h');
wolffd@0 4976 data.selected_vects=1:length(sData.data(:,1));
wolffd@0 4977 set(gcf,'UserData',data);
wolffd@0 4978 clear_button;
wolffd@0 4979 write_sD_stats;
wolffd@0 4980 set_compnames(sData,comp_names_h);
wolffd@0 4981 draw_vectors(ones(1,length(sData.data(:,1))),vector_h);
wolffd@0 4982 vect_means(sData,vect_mean_h,data.selected_vects);
wolffd@0 4983 cplot_mimema;
wolffd@0 4984 sel_comp;
wolffd@0 4985
wolffd@0 4986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4987
wolffd@0 4988 %%% Subfunction: remove_component %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 4989
wolffd@0 4990 function remove_component(varargin)
wolffd@0 4991
wolffd@0 4992 if nargin == 1
wolffd@0 4993 LOG=1;
wolffd@0 4994 value=str2num(varargin{1});
wolffd@0 4995 else
wolffd@0 4996 LOG=0;
wolffd@0 4997 end
wolffd@0 4998
wolffd@0 4999 data=get(gcf,'UserData');
wolffd@0 5000 vect_mean_h=getfield(get(gcf,'UserData'),'vect_mean_h');
wolffd@0 5001 vector_h=getfield(get(gcf,'UserData'),'vector_h');
wolffd@0 5002 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 5003 sData=data.sData;
wolffd@0 5004 undo=sData;
wolffd@0 5005 prompt='Enter the number of component to be removed.';
wolffd@0 5006 dim=length(sData.data(1,:));
wolffd@0 5007
wolffd@0 5008 if ~LOG
wolffd@0 5009 answer=inputdlg(prompt);
wolffd@0 5010
wolffd@0 5011 if isempty(answer) | (iscell(answer) & isempty(answer{1}))
wolffd@0 5012 msgbox('Components not removed.');
wolffd@0 5013 return;
wolffd@0 5014 end
wolffd@0 5015
wolffd@0 5016 value=str2num(answer{1});
wolffd@0 5017 dims=size(value);
wolffd@0 5018
wolffd@0 5019 if dims(1) ~= 1 | dims(2) ~= 1 | ~isreal(value)
wolffd@0 5020 errordlg('Number of the component to be removed must be positive integer.')
wolffd@0 5021 return;
wolffd@0 5022 end
wolffd@0 5023
wolffd@0 5024 if value <= 0 | round(value) ~= value
wolffd@0 5025 errordlg('Number of the component to be removed must be positive integer.');
wolffd@0 5026 return;
wolffd@0 5027 end
wolffd@0 5028
wolffd@0 5029 if value > getfield(size(sData.data),{2})
wolffd@0 5030 errordlg('There are less components.');
wolffd@0 5031 return;
wolffd@0 5032 end
wolffd@0 5033 end
wolffd@0 5034
wolffd@0 5035 sD_set_h=getfield(get(gcf,'UserData'),'sD_set_h');
wolffd@0 5036 index=get(sD_set_h,'Value');
wolffd@0 5037 if value == 1 & getfield(size(sData.data),{2}) == 1
wolffd@0 5038 if length(get(sD_set_h,'String')) == 1
wolffd@0 5039 msgbox('No data left. Closing program...')
wolffd@0 5040 pro_tools('close');
wolffd@0 5041 return;
wolffd@0 5042 end
wolffd@0 5043
wolffd@0 5044 set1=data.sD_set(1:index-1);
wolffd@0 5045 set2=data.sD_set(index+1:length(data.sD_set));
wolffd@0 5046 data.sD_set=[set1 set2];
wolffd@0 5047 set(gcf,'UserData',data);
wolffd@0 5048
wolffd@0 5049 set_sD_stats;
wolffd@0 5050 sel_sD;
wolffd@0 5051 data=get(gcf,'UserData');
wolffd@0 5052 data.undo.sData=undo;
wolffd@0 5053 data.undo.index=index;
wolffd@0 5054 set(gcf,'UserData',data);
wolffd@0 5055 return;
wolffd@0 5056 end
wolffd@0 5057 dims=size(sData.data);
wolffd@0 5058 tmp_data=cat(2,sData.data(:,1:value-1),sData.data(:,value+1:dims(2)));
wolffd@0 5059 tmp_norm=cat(1,sData.comp_norm(1:value-1),sData.comp_norm(value+1:dims(2)));
wolffd@0 5060 names=cat(1,sData.comp_names(1:value-1),sData.comp_names(value+1:dims(2)));
wolffd@0 5061 INDEX=sData.INDEX;
wolffd@0 5062 comp_norm=sData.comp_norm;
wolffd@0 5063 sData=som_data_struct(tmp_data,...
wolffd@0 5064 'name',sData.name,...
wolffd@0 5065 'labels',sData.labels,...
wolffd@0 5066 'comp_names',names);
wolffd@0 5067 sData.comp_norm=tmp_norm;
wolffd@0 5068 sData.MODIFIED=1;
wolffd@0 5069 sData.INDEX=INDEX;
wolffd@0 5070 data=get(gcf,'UserData');
wolffd@0 5071 data.sData=sData;
wolffd@0 5072 data.undo.sData=undo;
wolffd@0 5073 data.selected_vects=1:length(sData.data(:,1));
wolffd@0 5074 if ~LOG
wolffd@0 5075 data.LOG{length(data.LOG)+1}='% Remove component';
wolffd@0 5076 data.LOG{length(data.LOG)+1}=sprintf('preprocess(''remove'',''%s'');',...
wolffd@0 5077 answer{1});
wolffd@0 5078 end
wolffd@0 5079 set(gcf,'UserData',data);
wolffd@0 5080 clear_button;
wolffd@0 5081 write_sD_stats;
wolffd@0 5082 set_compnames(sData,comp_names_h);
wolffd@0 5083 tmp=ones(1,length(sData.data(:,1)));
wolffd@0 5084 draw_vectors(tmp,vector_h);
wolffd@0 5085 vect_means(sData,vect_mean_h,1:length(sData.data(:,1)));
wolffd@0 5086 cplot_mimema;
wolffd@0 5087 sel_comp;
wolffd@0 5088
wolffd@0 5089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5090
wolffd@0 5091 %%% Subfunction: remove_vects %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5092
wolffd@0 5093 function remove_vects(varargin)
wolffd@0 5094
wolffd@0 5095 if nargin==1
wolffd@0 5096 LOG=1;
wolffd@0 5097 tmp_str=varargin{1};
wolffd@0 5098 else
wolffd@0 5099 LOG=0;
wolffd@0 5100 tmp_str='_foo';
wolffd@0 5101 end
wolffd@0 5102 data=get(gcf,'UserData');
wolffd@0 5103 vect_mean_h=data.vect_mean_h;
wolffd@0 5104 vector_h=data.vector_h;
wolffd@0 5105 sData=data.sData;
wolffd@0 5106 undo=sData;
wolffd@0 5107
wolffd@0 5108 if length(data.selected_vects) == getfield(size(sData.data),{1})
wolffd@0 5109 if LOG
wolffd@0 5110 answer='Yes';
wolffd@0 5111 else
wolffd@0 5112 answer=questdlg('Do you want to delete this data set?');
wolffd@0 5113 end
wolffd@0 5114 if strcmp(answer,'No')
wolffd@0 5115 return;
wolffd@0 5116 else
wolffd@0 5117 index=get(data.sD_set_h,'Value');
wolffd@0 5118 if length(get(data.sD_set_h,'String')) == 1
wolffd@0 5119 msgbox('No data left. Closing program...')
wolffd@0 5120 pro_tools('close');
wolffd@0 5121 return;
wolffd@0 5122 end
wolffd@0 5123
wolffd@0 5124 set1=data.sD_set(1:index-1);
wolffd@0 5125 set2=data.sD_set(index+1:length(data.sD_set));
wolffd@0 5126 data.sD_set=[set1 set2];
wolffd@0 5127 set(gcf,'UserData',data);
wolffd@0 5128
wolffd@0 5129 set(data.sD_set_h,'Value',1);
wolffd@0 5130 set_sD_stats;
wolffd@0 5131 sel_sD;
wolffd@0 5132 data=get(gcf,'UserData');
wolffd@0 5133 data.undo.sData=undo;
wolffd@0 5134 data.undo.index=index;
wolffd@0 5135 if ~LOG
wolffd@0 5136 data.LOG{length(data.LOG)+1}='% Remove selected vectors';
wolffd@0 5137 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''remove_vects'',''',...
wolffd@0 5138 tmp_str,''');');
wolffd@0 5139 end
wolffd@0 5140 set(gcf,'UserData',data);
wolffd@0 5141 return;
wolffd@0 5142 end
wolffd@0 5143 end
wolffd@0 5144
wolffd@0 5145 tmp=sData.data(data.selected_vects,:);
wolffd@0 5146 if ~LOG
wolffd@0 5147 answer=questdlg('Do you want to save removed values to workspace?');
wolffd@0 5148 else
wolffd@0 5149 if ~strcmp(tmp_str,'_foo')
wolffd@0 5150 answer='Yes';
wolffd@0 5151 else
wolffd@0 5152 answer='No';
wolffd@0 5153 end
wolffd@0 5154 end
wolffd@0 5155 old=gcf;
wolffd@0 5156 if strcmp(answer,'Yes')
wolffd@0 5157 if ~LOG
wolffd@0 5158 answer=inputdlg('Give the name of the output -variable.');
wolffd@0 5159 else
wolffd@0 5160 answer={tmp_str};
wolffd@0 5161 end
wolffd@0 5162 if isvalid_var_name(answer)
wolffd@0 5163 assignin('base',answer{1},tmp);
wolffd@0 5164 disp(sprintf('Removed values are set to workspace as''%s''.',answer{1}));
wolffd@0 5165 tmp_str=answer{1};
wolffd@0 5166 end
wolffd@0 5167 end
wolffd@0 5168 set(0,'CurrentFigure',old);
wolffd@0 5169 sData.data(data.selected_vects,:)=[];
wolffd@0 5170 sData.labels(data.selected_vects,:)=[];
wolffd@0 5171 sData.MODIFIED=1;
wolffd@0 5172 data.sData=sData;
wolffd@0 5173 data.selected=1:length(sData.data(:,1));
wolffd@0 5174 data.undo.sData=undo;
wolffd@0 5175 if ~LOG
wolffd@0 5176 data.LOG{length(data.LOG)}='% Remove selected vectors';
wolffd@0 5177 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''remove_vects'',''',...
wolffd@0 5178 tmp_str,''');');
wolffd@0 5179 end
wolffd@0 5180 set(gcf,'UserData',data);
wolffd@0 5181
wolffd@0 5182
wolffd@0 5183 draw_vectors(ones(1,length(data.selected)),data.vector_h);
wolffd@0 5184 write_sD_stats;
wolffd@0 5185 select_all('foo');
wolffd@0 5186
wolffd@0 5187
wolffd@0 5188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5189
wolffd@0 5190
wolffd@0 5191
wolffd@0 5192
wolffd@0 5193 %%% Subfunction: eval1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5194
wolffd@0 5195 function eval1(varargin);
wolffd@0 5196
wolffd@0 5197 if nargin == 1
wolffd@0 5198 answer=varargin
wolffd@0 5199 LOG=1;
wolffd@0 5200 else
wolffd@0 5201 LOG=0;
wolffd@0 5202 end
wolffd@0 5203
wolffd@0 5204 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 5205 if isempty(pre_h)
wolffd@0 5206 errordlg('''Preprocess''-figure does not exist. Terminating program...');
wolffd@0 5207 pro_tools('close');
wolffd@0 5208 return;
wolffd@0 5209 end
wolffd@0 5210
wolffd@0 5211 undo=getfield(get(pre_h,'UserData'),'sData');
wolffd@0 5212
wolffd@0 5213 if ~LOG
wolffd@0 5214 prompt={'Enter the expression to be evaluated.',...
wolffd@0 5215 'Enter the inverse normalization method (optional).'};
wolffd@0 5216 title='Single component eval.';
wolffd@0 5217 answer= inputdlg(prompt,title,1);
wolffd@0 5218 end
wolffd@0 5219
wolffd@0 5220 if ~isempty(answer)
wolffd@0 5221 tmp=[];
wolffd@0 5222 if ~isempty(answer{1})
wolffd@0 5223 [tmp,method]=build_expr(answer{1},'single');
wolffd@0 5224 if ~isstr(tmp)
wolffd@0 5225 sData=getfield(get(gcf,'UserData'),'sData');
wolffd@0 5226 tmp='Done.';
wolffd@0 5227 %if ~isempty(answer{2})
wolffd@0 5228 % sN=som_norm_struct('eval',{method,answer{2}});
wolffd@0 5229 %else
wolffd@0 5230 % sN=som_norm_struct('eval',{method});
wolffd@0 5231 %end
wolffd@0 5232 %sN=som_set(sN,'status','done');
wolffd@0 5233 params={answer{1};answer{2}};
wolffd@0 5234 ind=getfield(get_indices,{1});
wolffd@0 5235 x.type='';
wolffd@0 5236 x.method='eval';
wolffd@0 5237 x.params={answer{1};answer{2}};
wolffd@0 5238 x.status='';
wolffd@0 5239 sData.comp_norm{ind}=x;
wolffd@0 5240 data=get(gcf,'UserData');
wolffd@0 5241 data.undo.sData=undo;
wolffd@0 5242 data.sData=sData;
wolffd@0 5243 if ~LOG
wolffd@0 5244 data.LOG{length(data.LOG)+1}='% Eval (1-comp)';
wolffd@0 5245 data.LOG{length(data.LOG)+1}=cat(2,'preprocess eval1 ',...
wolffd@0 5246 sprintf('{''%s'' ''%s''};',answer{1},answer{2}));
wolffd@0 5247 end
wolffd@0 5248 set(pre_h,'UserData',data);
wolffd@0 5249
wolffd@0 5250 end
wolffd@0 5251 end
wolffd@0 5252 set(getfield(get(pre_h,'UserData'),'results_h'),'String',tmp);
wolffd@0 5253 end
wolffd@0 5254
wolffd@0 5255
wolffd@0 5256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5257
wolffd@0 5258 %%% Subfunction: eval2
wolffd@0 5259
wolffd@0 5260 function eval2(varargin)
wolffd@0 5261
wolffd@0 5262 if nargin == 1
wolffd@0 5263 answer=varargin{1};
wolffd@0 5264 LOG=1;
wolffd@0 5265 else
wolffd@0 5266 LOG=0;
wolffd@0 5267 end
wolffd@0 5268
wolffd@0 5269 undo=getfield(get(gcf,'UserData'),'sData');
wolffd@0 5270 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 5271
wolffd@0 5272 if isempty(pre_h)
wolffd@0 5273 errordlg('''Preprocess''-figure does not exist. Terminating program.');
wolffd@0 5274 pro_tools('close');
wolffd@0 5275 return;
wolffd@0 5276 end
wolffd@0 5277
wolffd@0 5278 if ~LOG
wolffd@0 5279 prompt='Enter the expression to be evaluated.';
wolffd@0 5280 title ='Eval';
wolffd@0 5281 answer=inputdlg(prompt,title,1);
wolffd@0 5282 end
wolffd@0 5283
wolffd@0 5284 if ~isempty(answer) & ~isempty(answer{1})
wolffd@0 5285 str=answer{1};
wolffd@0 5286 [answer,foo]=build_expr(answer{1},'multiple');
wolffd@0 5287 if ~isstr(answer)
wolffd@0 5288
wolffd@0 5289 answer='Done.';
wolffd@0 5290 data=get(gcf,'UserData');
wolffd@0 5291 data.undo.sData=undo;
wolffd@0 5292 if ~LOG
wolffd@0 5293 data.LOG{length(data.LOG)+1}='% Eval';
wolffd@0 5294 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''eval2'',',...
wolffd@0 5295 sprintf('{''%s''});',str));
wolffd@0 5296 end
wolffd@0 5297 set(gcf,'UserData',data);
wolffd@0 5298 end
wolffd@0 5299 end
wolffd@0 5300
wolffd@0 5301 set(getfield(get(pre_h,'UserData'),'results_h'),'String',answer);
wolffd@0 5302
wolffd@0 5303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5304
wolffd@0 5305 %%% Subfunction: zero2one_scale %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5306
wolffd@0 5307 function zero2one_scale(varargin)
wolffd@0 5308
wolffd@0 5309 if nargin == 1
wolffd@0 5310 LOG=1;
wolffd@0 5311 else
wolffd@0 5312 LOG=0;
wolffd@0 5313 end
wolffd@0 5314
wolffd@0 5315
wolffd@0 5316 data=get(gcf,'UserData');
wolffd@0 5317 sData=data.sData;
wolffd@0 5318 undo=sData;
wolffd@0 5319 INDEX=sData.INDEX;
wolffd@0 5320 sData=rmfield(sData,[{'INDEX'};{'MODIFIED'}]);
wolffd@0 5321
wolffd@0 5322 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5323 errordlg('There must be components chosen for scaling.');
wolffd@0 5324 return;
wolffd@0 5325 end
wolffd@0 5326
wolffd@0 5327 sData=som_normalize(sData,'range',get_indices);
wolffd@0 5328 sData.MODIFIED=1;
wolffd@0 5329 sData.INDEX=INDEX;
wolffd@0 5330
wolffd@0 5331 data.sData=sData;
wolffd@0 5332 data.undo.sData=undo;
wolffd@0 5333 if ~LOG
wolffd@0 5334 data.LOG{length(data.LOG)+1}='% Scale [0,1]';
wolffd@0 5335 data.LOG{length(data.LOG)+1}='preprocess(''zscale'', ''foo'');';
wolffd@0 5336 end
wolffd@0 5337 set(gcf,'UserData',data);
wolffd@0 5338
wolffd@0 5339 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 5340 vects(data.selected_vects)=1;
wolffd@0 5341
wolffd@0 5342 cplot_mimema;
wolffd@0 5343 plot_hist;
wolffd@0 5344 vect_means(sData,data.vect_mean_h,data.selected_vects);
wolffd@0 5345 draw_vectors(vects,data.vector_h);
wolffd@0 5346
wolffd@0 5347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5348
wolffd@0 5349 %%% Subfunction: var_scale %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5350
wolffd@0 5351 function var_scale(varargin)
wolffd@0 5352
wolffd@0 5353 if nargin == 1
wolffd@0 5354 LOG=1;
wolffd@0 5355 else
wolffd@0 5356 LOG=0;
wolffd@0 5357 end
wolffd@0 5358
wolffd@0 5359 data=get(gcf,'UserData');
wolffd@0 5360 sData=data.sData;
wolffd@0 5361 undo=sData;
wolffd@0 5362 INDEX=sData.INDEX;
wolffd@0 5363 sData=rmfield(sData,[{'INDEX'};{'MODIFIED'}]);
wolffd@0 5364
wolffd@0 5365 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5366 errordlg('There must be components chosen for scaling.');
wolffd@0 5367 return;
wolffd@0 5368 end
wolffd@0 5369
wolffd@0 5370 sData=som_normalize(sData,'var',get_indices);
wolffd@0 5371
wolffd@0 5372 sData.INDEX=INDEX;
wolffd@0 5373 sData.MODIFIED=1;
wolffd@0 5374
wolffd@0 5375 data.sData=sData;
wolffd@0 5376 data.undo.sData=undo;
wolffd@0 5377 if ~LOG
wolffd@0 5378 data.LOG{length(data.LOG)+1}='% Scale var=1';
wolffd@0 5379 data.LOG{length(data.LOG)+1}='preprocess(''vscale'', ''foo'');';
wolffd@0 5380 end
wolffd@0 5381 set(gcf,'UserData',data);
wolffd@0 5382
wolffd@0 5383 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 5384 vects(data.selected_vects)=1;
wolffd@0 5385
wolffd@0 5386 cplot_mimema;
wolffd@0 5387 plot_hist;
wolffd@0 5388 vect_means(sData,data.vect_mean_h,data.selected_vects);
wolffd@0 5389 draw_vectors(vects,data.vector_h);
wolffd@0 5390
wolffd@0 5391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5392
wolffd@0 5393 %%% Subfunction: hist_eq %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5394
wolffd@0 5395 function hist_eq(varargin)
wolffd@0 5396
wolffd@0 5397 if nargin == 1
wolffd@0 5398 LOG=1;
wolffd@0 5399 else
wolffd@0 5400 LOG=0;
wolffd@0 5401 end
wolffd@0 5402
wolffd@0 5403 data=get(gcf,'UserData');
wolffd@0 5404 sData=data.sData;
wolffd@0 5405 undo=sData;
wolffd@0 5406 INDEX=sData.INDEX;
wolffd@0 5407 sData=rmfield(sData,[{'INDEX'},{'MODIFIED'}]);
wolffd@0 5408
wolffd@0 5409 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5410 errordlg('There must be components chosen for ''Histogram eq''.');
wolffd@0 5411 return;
wolffd@0 5412 end
wolffd@0 5413
wolffd@0 5414 sData=som_normalize(sData,'histD',get_indices);
wolffd@0 5415
wolffd@0 5416 sData.INDEX=INDEX;
wolffd@0 5417 sData.MODIFIED=1;
wolffd@0 5418
wolffd@0 5419 data.sData=sData;
wolffd@0 5420 data.undo.sData=undo;
wolffd@0 5421 if ~LOG
wolffd@0 5422 data.LOG{length(data.LOG)+1}='% Histogram eq';
wolffd@0 5423 data.LOG{length(data.LOG)+1}='preprocess(''histeq'', ''foo'');';
wolffd@0 5424 end
wolffd@0 5425 set(gcf,'UserData',data);
wolffd@0 5426
wolffd@0 5427 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 5428 vects(data.selected_vects)=1;
wolffd@0 5429
wolffd@0 5430 cplot_mimema;
wolffd@0 5431 plot_hist;
wolffd@0 5432 vect_means(sData,data.vect_mean_h,data.selected_vects);
wolffd@0 5433 draw_vectors(vects,data.vector_h);
wolffd@0 5434
wolffd@0 5435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5436
wolffd@0 5437 %%% Subfunction: hist_eq2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5438
wolffd@0 5439 function hist_eq2(varargin)
wolffd@0 5440
wolffd@0 5441 if nargin == 1
wolffd@0 5442 LOG=1;
wolffd@0 5443 else
wolffd@0 5444 LOG=0;
wolffd@0 5445 end
wolffd@0 5446
wolffd@0 5447
wolffd@0 5448 data=get(gcf,'UserData');
wolffd@0 5449 sData=data.sData;
wolffd@0 5450 undo=sData;
wolffd@0 5451
wolffd@0 5452 INDEX=sData.INDEX;
wolffd@0 5453 sData=rmfield(sData,[{'INDEX'};{'MODIFIED'}]);
wolffd@0 5454
wolffd@0 5455 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5456 errordlg('There must be components chosen for ''Histogram eq2''.');
wolffd@0 5457 return;
wolffd@0 5458 end
wolffd@0 5459
wolffd@0 5460 inds=get_indices;
wolffd@0 5461 %%%[sData,ok]=som_normalize(sData,inds,'histC');
wolffd@0 5462 sData=som_normalize(sData,'histC',inds);
wolffd@0 5463 sData.INDEX=INDEX;
wolffd@0 5464 sData.MODIFIED=1;
wolffd@0 5465
wolffd@0 5466 data.sData=sData;
wolffd@0 5467 data.undo.sData=undo;
wolffd@0 5468 if ~LOG
wolffd@0 5469 data.LOG{length(data.LOG)+1}='% Histogram eq2';
wolffd@0 5470 data.LOG{length(data.LOG)+1}='preprocess(''histeq2'', ''foo'');';
wolffd@0 5471 end
wolffd@0 5472 set(gcf,'UserData',data);
wolffd@0 5473
wolffd@0 5474 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 5475 vects(data.selected_vects)=1;
wolffd@0 5476
wolffd@0 5477 cplot_mimema;
wolffd@0 5478 plot_hist;
wolffd@0 5479 vect_means(sData,data.vect_mean_h,data.selected_vects);
wolffd@0 5480 draw_vectors(vects,data.vector_h);
wolffd@0 5481
wolffd@0 5482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5483
wolffd@0 5484 %%% Subfunction: logarithm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5485
wolffd@0 5486 function logarithm(varargin)
wolffd@0 5487
wolffd@0 5488 if nargin == 1
wolffd@0 5489 LOG=1;
wolffd@0 5490 else
wolffd@0 5491 LOG=0;
wolffd@0 5492 end
wolffd@0 5493
wolffd@0 5494 data=get(gcf,'UserData');
wolffd@0 5495 sData=data.sData;
wolffd@0 5496 undo=sData;
wolffd@0 5497
wolffd@0 5498 INDEX=sData.INDEX;
wolffd@0 5499 sData=rmfield(sData,[{'INDEX'},{'MODIFIED'}]);
wolffd@0 5500
wolffd@0 5501 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5502 errordlg('There must be components chosen for ''Log''.');
wolffd@0 5503 return;
wolffd@0 5504 end
wolffd@0 5505
wolffd@0 5506 Data=som_normalize(sData,'log',get_indices);
wolffd@0 5507
wolffd@0 5508 sData.INDEX=INDEX;
wolffd@0 5509 sData.MODIFIED=1;
wolffd@0 5510
wolffd@0 5511 data.sData=sData;
wolffd@0 5512 data.undo.sData=undo;
wolffd@0 5513 if ~LOG
wolffd@0 5514 data.LOG{length(data.LOG)+1}='% Log';
wolffd@0 5515 data.LOG{length(data.LOG)+1}='preprocess(''log'', ''foo'');';
wolffd@0 5516 end
wolffd@0 5517 set(gcf,'UserData',data);
wolffd@0 5518
wolffd@0 5519 vects=zeros(1,length(sData.data(:,1)));
wolffd@0 5520 vects(data.selected_vects)=1;
wolffd@0 5521
wolffd@0 5522 cplot_mimema;
wolffd@0 5523 plot_hist;
wolffd@0 5524 vect_means(sData,data.vect_mean_h,data.selected_vects);
wolffd@0 5525 draw_vectors(vects,data.vector_h);
wolffd@0 5526
wolffd@0 5527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5528
wolffd@0 5529 function [answer,method]=build_expr(string,evaltype)
wolffd@0 5530
wolffd@0 5531 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 5532
wolffd@0 5533 method=[];
wolffd@0 5534 if isempty(pre_h)
wolffd@0 5535 close_preprocess;
wolffd@0 5536 errordlg('''Preprocess'' -figure does not exist. Terminating program...');
wolffd@0 5537 return;
wolffd@0 5538
wolffd@0 5539 end
wolffd@0 5540
wolffd@0 5541 if isempty(string)
wolffd@0 5542 str = '[]';
wolffd@0 5543 return;
wolffd@0 5544 end
wolffd@0 5545
wolffd@0 5546 tmp=[];
wolffd@0 5547 [name,assign,skip]=check_assign(string,evaltype);
wolffd@0 5548
wolffd@0 5549 if ~strcmp(assign,'NOTASSIGN') & ~strcmp(assign,'error')
wolffd@0 5550 string=string(skip:length(string));
wolffd@0 5551 end
wolffd@0 5552
wolffd@0 5553 if ~strcmp(assign,'error')
wolffd@0 5554 if isempty(string)
wolffd@0 5555 answer='Illegal expression.';
wolffd@0 5556 return;
wolffd@0 5557 end
wolffd@0 5558 [str,skip]=check_token(string,evaltype);
wolffd@0 5559 method=string;
wolffd@0 5560 while ~strcmp(str,'error') & ~strcmp(tmp,'error') & skip < length(string)
wolffd@0 5561 if ~strcmp(tmp,')')
wolffd@0 5562 str=cat(2,str,tmp);
wolffd@0 5563 end
wolffd@0 5564 [tmp,skip2]=check_token(string(skip+1:length(string)),evaltype);
wolffd@0 5565 skip=skip+skip2;
wolffd@0 5566
wolffd@0 5567 end
wolffd@0 5568 if ~strcmp(tmp,')') & ~strcmp(tmp,'error')
wolffd@0 5569 str=cat(2,str,tmp);
wolffd@0 5570 elseif strcmp(tmp,'error')
wolffd@0 5571 str='error';
wolffd@0 5572 end
wolffd@0 5573 end
wolffd@0 5574
wolffd@0 5575 if ~strcmp(assign,'error') & ~strcmp(str,'error');
wolffd@0 5576 answer=evalin('caller',str,'lasterr');
wolffd@0 5577 else
wolffd@0 5578 answer='??? Illegal expression.';
wolffd@0 5579 end
wolffd@0 5580
wolffd@0 5581
wolffd@0 5582 data=get(pre_h,'UserData');
wolffd@0 5583 sData=data.sData;
wolffd@0 5584 if strcmp(assign,'NOTASSIGN') & strcmp(evaltype,'single') & ~isstr(answer)
wolffd@0 5585 if isempty(get(getfield(get(pre_h,'UserData'),'comp_names_h'),'Value'))
wolffd@0 5586 errordlg('There are not components chosen.');
wolffd@0 5587 answer='??? Illegal expression.';
wolffd@0 5588 return;
wolffd@0 5589 end
wolffd@0 5590 index=getfield(get_indices,{1});
wolffd@0 5591 if strcmp(assign,'NOTASSIGN')
wolffd@0 5592 if length(sData.data(:,index)) ~=length(answer) & ~isscalar(answer)
wolffd@0 5593 answer='??? Illegal assignment.';
wolffd@0 5594 else
wolffd@0 5595 sData.data(:,index)=answer;
wolffd@0 5596 sData.MODIFIED=1;
wolffd@0 5597 data.sData=sData;
wolffd@0 5598 set(pre_h,'UserData',data);
wolffd@0 5599 end
wolffd@0 5600 else
wolffd@0 5601 if length(sData.data(str2num(assign),index)) ~=length(answer) & ~isscalar(answer)
wolffd@0 5602 answer='??? Illegal assignment.';
wolffd@0 5603 else
wolffd@0 5604 sData.data(str2num(assign),index)=answer;
wolffd@0 5605 sData.MODIFIED=1;
wolffd@0 5606 data.sData=sData;
wolffd@0 5607 set(pre_h,'UserData',data);
wolffd@0 5608 end
wolffd@0 5609 end
wolffd@0 5610 elseif ~strcmp(assign,'error') & ~isstr(answer) & ~strcmp(assign,'NOTASSIGN')
wolffd@0 5611 switch name
wolffd@0 5612 case 'x'
wolffd@0 5613 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5614 return;
wolffd@0 5615 end
wolffd@0 5616 index = getfield(get_indices,{1});
wolffd@0 5617 if isempty(assign)
wolffd@0 5618 if length(sData.data(:,index)) ~= length(answer) & ~isscalar(answer)
wolffd@0 5619 answer='??? Illegal assignment.';
wolffd@0 5620 else
wolffd@0 5621 sData.data(:,index)=answer;
wolffd@0 5622 sData.MODIFIED=1;
wolffd@0 5623 data.sData=sData;
wolffd@0 5624 if strcmp(evaltype,'multiple')
wolffd@0 5625 data.sData.comp_norm(index)={[]};
wolffd@0 5626 end
wolffd@0 5627 set(pre_h,'UserData',data);
wolffd@0 5628 end
wolffd@0 5629 else
wolffd@0 5630 args=create_args(assign,'x');
wolffd@0 5631 if length(args) == 1
wolffd@0 5632 len=max(str2num(args{1}));
wolffd@0 5633 if ~isscalar(len)
wolffd@0 5634 answer='??? Illegal assignment.';
wolffd@0 5635 return;
wolffd@0 5636 elseif len > length(sData.data(:,1)) | min(str2num(args{1})) < 1
wolffd@0 5637 answer='??? Illegal assignment.';
wolffd@0 5638 return;
wolffd@0 5639 elseif ~all(size(sData.data(str2num(args{1}),index))) == size(answer) & ~isscalar(answer)
wolffd@0 5640 answer='??? Illegal assignment.';
wolffd@0 5641 return;
wolffd@0 5642 else
wolffd@0 5643 sData.data(str2num(args{1}),index)=answer;
wolffd@0 5644 sData.MODIFIED=1;
wolffd@0 5645 data.sData=sData;
wolffd@0 5646 if strcmp(evaltype,'multiple')
wolffd@0 5647 data.sData.comp_norm(index)={[]};
wolffd@0 5648 end
wolffd@0 5649 set(pre_h,'UserData',data);
wolffd@0 5650 end
wolffd@0 5651 else
wolffd@0 5652 len=max(str2num(args{1}));
wolffd@0 5653 dim=max(str2num(args{2}));
wolffd@0 5654 asize=size(answer);
wolffd@0 5655 msize=size(sData.data);
wolffd@0 5656 if ~isscalar(len) | ~isscalar(dim)
wolffd@0 5657 answer='??? Illegal assignment.';
wolffd@0 5658 return;
wolffd@0 5659 elseif len > length(sData.data(:,1)) | len < 1
wolffd@0 5660 answer='??? Illegal assignment.';
wolffd@0 5661 return;
wolffd@0 5662 elseif dim > 1 | dim > msize(2) | min(str2num(args{2})) < 1
wolffd@0 5663 answer='??? Illegal assignment.';
wolffd@0 5664 return;
wolffd@0 5665 end
wolffd@0 5666 len=length(str2num(args{1}));
wolffd@0 5667 dim=length(str2num(args{1}));
wolffd@0 5668 if ~all([len dim] == asize) & ~isscalar(answer)
wolffd@0 5669 answer='??? Illegal assignment.';
wolffd@0 5670 return;
wolffd@0 5671 else
wolffd@0 5672 tmp=sData.data(:,index);
wolffd@0 5673 tmp([str2num(args{1})],[str2num(args{2})])=answer;
wolffd@0 5674 sData.data(:,index)=tmp;
wolffd@0 5675 sData.MODIFIED=1;
wolffd@0 5676 data.sData=sData;
wolffd@0 5677 if strcmp(evaltype,'multiple')
wolffd@0 5678 data.sData.comp_norm(index)={[]};
wolffd@0 5679 end
wolffd@0 5680 set(pre_h,'UserData',data);
wolffd@0 5681 end
wolffd@0 5682 end
wolffd@0 5683 end
wolffd@0 5684
wolffd@0 5685 case 'xs'
wolffd@0 5686 if isempty(get(data.comp_names_h,'Value'))
wolffd@0 5687 return;
wolffd@0 5688 end
wolffd@0 5689 indices=get_indices;
wolffd@0 5690 if isempty(assign)
wolffd@0 5691 if ~all(size(answer) == size(sData.data(:,indices))) & ~isscalar(answer)
wolffd@0 5692 answer='??? Illegal assignment.';
wolffd@0 5693 else
wolffd@0 5694 sData.data(:,indices) = answer;
wolffd@0 5695 sData.MODIFIED=1;
wolffd@0 5696 data.sData=sData;
wolffd@0 5697 data.sData.comp_norm(indices)={[]};
wolffd@0 5698 set(pre_h,'UserData',data);
wolffd@0 5699 end
wolffd@0 5700 else
wolffd@0 5701 args=create_args(assign,'xs');
wolffd@0 5702 if length(args) == 1
wolffd@0 5703 len=max(str2num(args{1}));
wolffd@0 5704 if ~isscalar(len)
wolffd@0 5705 answer='??? Illegal assignment.';
wolffd@0 5706 return;
wolffd@0 5707 elseif len > length(sData.data(:,1)) | min(str2num(args{1})) < 1
wolffd@0 5708 answer='??? Illegal assignment.';
wolffd@0 5709 return;
wolffd@0 5710 end
wolffd@0 5711 if ~all(size(answer) == size(sData.data(str2num(args{1})))) &...
wolffd@0 5712 ~isscalar(answer)
wolffd@0 5713 answer='??? Illegal assignment.';
wolffd@0 5714 return;
wolffd@0 5715 else
wolffd@0 5716 tmp=sData.data(:,indices);
wolffd@0 5717 tmp(str2num(args{1}))=answer;
wolffd@0 5718 sData.data(:,indices)=tmp;
wolffd@0 5719 sData.MODIFIED=1;
wolffd@0 5720 sData.comp_norm{indices}={[]};
wolffd@0 5721 data.sData=sData;
wolffd@0 5722 set(pre_h,'UserData',data);
wolffd@0 5723 end
wolffd@0 5724 else
wolffd@0 5725 len=max(str2num(args{1}));
wolffd@0 5726 dim=max(str2num(args{2}));
wolffd@0 5727 asize=size(answer);
wolffd@0 5728 msize=size(sData.data(:,indices));
wolffd@0 5729 if ~isscalar(len) | ~isscalar(dim)
wolffd@0 5730 answer='??? Illegal assignment.';
wolffd@0 5731 return;
wolffd@0 5732 elseif len > msize(1) | min(str2num(args{1})) < 1
wolffd@0 5733 answer='??? Illegal assignment.';
wolffd@0 5734 return;
wolffd@0 5735 elseif dim > msize(2) | min(str2num(args{2})) < 1
wolffd@0 5736 answer='??? Illegal assignment.';
wolffd@0 5737 return;
wolffd@0 5738 end
wolffd@0 5739 len=length(str2num(args{1}));
wolffd@0 5740 dim=length(str2num(args{2}));
wolffd@0 5741 if ~all([len dim] == asize) & ~isscalar(answer)
wolffd@0 5742 answer='??? Illegal assignment';
wolffd@0 5743 return;
wolffd@0 5744 else
wolffd@0 5745 tmp=sData.data(:,indices);
wolffd@0 5746 tmp([str2num(args{1})],[str2num(args{2})])=answer;
wolffd@0 5747 sData.MODIFIED=1;
wolffd@0 5748 sData.data(:,indices)=tmp;
wolffd@0 5749 data.sData=sData;
wolffd@0 5750 data.sData.comp_norm(indices)={[]};
wolffd@0 5751 set(pre_h,'UserData',data);
wolffd@0 5752 end
wolffd@0 5753
wolffd@0 5754 end
wolffd@0 5755 end
wolffd@0 5756
wolffd@0 5757 case 'D'
wolffd@0 5758 if isempty(assign)
wolffd@0 5759 if ~all(size(answer) == size(sData.data)) & ~isscalar(answer)
wolffd@0 5760 answer='??? Illegal assignment.';
wolffd@0 5761 else
wolffd@0 5762 if isscalar(answer)
wolffd@0 5763 sData.data(:,:)=answer;
wolffd@0 5764 else
wolffd@0 5765 sData.data=answer;
wolffd@0 5766 end
wolffd@0 5767 sData.MODIFIED=1;
wolffd@0 5768 data.sData=sData;
wolffd@0 5769 data.sData.comp_norm(1:length(sData.data(1,:)))={[]};
wolffd@0 5770 set(pre_h,'UserData',data);
wolffd@0 5771 end
wolffd@0 5772 else
wolffd@0 5773 args=create_args(assign,'D');
wolffd@0 5774 if length(args) == 1
wolffd@0 5775 len=max(str2num(args{1}));
wolffd@0 5776 if ~isscalar(len)
wolffd@0 5777 answer='??? Illegal assignment.';
wolffd@0 5778 return;
wolffd@0 5779 elseif len > length(sData.data(:,1)) | min(str2num(args{1})) < 1
wolffd@0 5780 answer='??? Illegal assignment.';
wolffd@0 5781 return;
wolffd@0 5782 end
wolffd@0 5783 if ~all(size(answer) == size(sData.data(str2num(args{1})))) &...
wolffd@0 5784 ~isscalar(answer)
wolffd@0 5785 answer='??? Illegal assignment.';
wolffd@0 5786 else
wolffd@0 5787 sData.data(str2num(args{1}))=answer;
wolffd@0 5788 sData.MODIFIED=1;
wolffd@0 5789 data.sData=sData;
wolffd@0 5790 [i,j]=ind2sub(size(sData.data),str2num(args{1}));
wolffd@0 5791 data.sData.comp_norm(j)={[]};
wolffd@0 5792 set(pre_h,'UserData',data);
wolffd@0 5793 end
wolffd@0 5794 else
wolffd@0 5795 len=max(str2num(args{1}));
wolffd@0 5796 dim=max(str2num(args{2}));
wolffd@0 5797 asize=size(answer);
wolffd@0 5798 msize=size(sData.data);
wolffd@0 5799 if ~isscalar(len) | ~isscalar(dim)
wolffd@0 5800 answer='??? Illegal assignment.';
wolffd@0 5801 return;
wolffd@0 5802 elseif len > msize(1) | min(str2num(args{1})) < 1
wolffd@0 5803 answer='??? Illegal assignment.';
wolffd@0 5804 return;
wolffd@0 5805 elseif dim > msize(2) | min(str2num(args{2})) < 1
wolffd@0 5806 answer= '??? Illegal assignment.';
wolffd@0 5807 return;
wolffd@0 5808 end
wolffd@0 5809 len = length(str2num(args{1}));
wolffd@0 5810 dim = length(str2num(args{2}));
wolffd@0 5811 if ~all([len dim] == asize) & ~isscalar(answer)
wolffd@0 5812 answer='??? Illegal assignment.';
wolffd@0 5813 return;
wolffd@0 5814 else
wolffd@0 5815 sData.data([str2num(args{1})],[str2num(args{2})])=answer;
wolffd@0 5816 sData.MODIFIED=1;
wolffd@0 5817 data.sData=sData;
wolffd@0 5818 data.sData.comp_norm(str2num(args{2}))={[]};
wolffd@0 5819 set(pre_h,'UserData',data);
wolffd@0 5820 end
wolffd@0 5821 end
wolffd@0 5822 end
wolffd@0 5823 end
wolffd@0 5824 end
wolffd@0 5825 if sData.MODIFIED
wolffd@0 5826 selected=getfield(get(pre_h,'UserData'),'selected_vects');
wolffd@0 5827 vector_h=getfield(get(pre_h,'UserData'),'vector_h');
wolffd@0 5828 vect_mean_h=getfield(get(pre_h,'UserData'),'vect_mean_h');
wolffd@0 5829 vects=zeros(length(sData.data(:,1)));
wolffd@0 5830 vects(selected)=1;
wolffd@0 5831 draw_vectors(vects,vector_h);
wolffd@0 5832 vect_means(sData,vect_mean_h,selected);
wolffd@0 5833 pro_tools('plot_hist');
wolffd@0 5834 pro_tools('c_stat');
wolffd@0 5835 cplot_mimema;
wolffd@0 5836 end
wolffd@0 5837
wolffd@0 5838
wolffd@0 5839 %%% Subfunction: check_assign %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5840
wolffd@0 5841 function [name,string,skip]=check_assign(string,evaltype)
wolffd@0 5842
wolffd@0 5843
wolffd@0 5844 reswords=[{'D'};{'x'};{'xs'}];
wolffd@0 5845 flag=0;
wolffd@0 5846 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 5847
wolffd@0 5848 if isempty(pre_h)
wolffd@0 5849 man_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 5850 clip_h=findobj(get(0,'Children'),'Tag','Clipping');
wolffd@0 5851 errordlg('''Preprocess'' -window does not exist. Terminating program.');
wolffd@0 5852 if ~isempty(man_h)
wolffd@0 5853 close man_h;
wolffd@0 5854 end
wolffd@0 5855 if ~isempty(clip_h)
wolffd@0 5856 close clip_h;
wolffd@0 5857 end
wolffd@0 5858 return;
wolffd@0 5859 end
wolffd@0 5860
wolffd@0 5861 EMPTY=isempty(get(getfield(get(pre_h,'UserData'),'comp_names_h'),'Value'));
wolffd@0 5862
wolffd@0 5863 [name,s]=give_token(string,evaltype);
wolffd@0 5864 skip=length(s);
wolffd@0 5865
wolffd@0 5866 if strcmp(evaltype,'single') & ~strcmp(name,'x')
wolffd@0 5867 string='NOTASSIGN';
wolffd@0 5868 return;
wolffd@0 5869 end
wolffd@0 5870
wolffd@0 5871 if strcmp(name,'other') & ~strcmp(s,'x')
wolffd@0 5872 string = 'error';
wolffd@0 5873 return;
wolffd@0 5874 end
wolffd@0 5875
wolffd@0 5876 if strcmp(name,[{'x'};{'xs'}])
wolffd@0 5877 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 5878 if isempty(get(comp_names_h,'Value'))
wolffd@0 5879 errordlg('There are not components chosen.');
wolffd@0 5880 string='error';
wolffd@0 5881 return;
wolffd@0 5882 end
wolffd@0 5883 end
wolffd@0 5884
wolffd@0 5885
wolffd@0 5886 if skip == length(string) | ~strcmp(name,reswords)
wolffd@0 5887 string = 'NOTASSIGN';
wolffd@0 5888 return;
wolffd@0 5889 end
wolffd@0 5890
wolffd@0 5891 if (strcmp(name,'x') | strcmp(name,'xs')) & EMPTY
wolffd@0 5892 errordlg('There are not components chosen.');
wolffd@0 5893 string = 'error';
wolffd@0 5894 return;
wolffd@0 5895 end
wolffd@0 5896
wolffd@0 5897 [t,s]=give_token(string(length(name)+1),evaltype);
wolffd@0 5898
wolffd@0 5899 if strcmp(t,'(')
wolffd@0 5900 flag=1;
wolffd@0 5901 end
wolffd@0 5902
wolffd@0 5903 [foo,skip]=check_token(string,evaltype);
wolffd@0 5904 if length(name) ~= skip-1
wolffd@0 5905 skip=skip-1;
wolffd@0 5906 tmp=string(length(name)+1:skip);
wolffd@0 5907 else
wolffd@0 5908 tmp = [];
wolffd@0 5909 end
wolffd@0 5910
wolffd@0 5911 if flag & tmp(length(tmp)) ~= ')'
wolffd@0 5912 tmp(length(tmp)+1)=')';
wolffd@0 5913 end
wolffd@0 5914
wolffd@0 5915 if skip==length(string)
wolffd@0 5916 return;
wolffd@0 5917 end
wolffd@0 5918
wolffd@0 5919 skip=skip+1;
wolffd@0 5920 if length(string) ~= skip
wolffd@0 5921 [t,s]=give_token(string(skip+1:length(string)),evaltype);
wolffd@0 5922 else
wolffd@0 5923 string='NOTASSIGN';
wolffd@0 5924 return;
wolffd@0 5925 end
wolffd@0 5926
wolffd@0 5927 if ~strcmp(t,'=')
wolffd@0 5928 string = 'NOTASSIGN';
wolffd@0 5929 return;
wolffd@0 5930 end
wolffd@0 5931 string=tmp;
wolffd@0 5932 skip = skip+2;
wolffd@0 5933
wolffd@0 5934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5935
wolffd@0 5936 %%% Subfunction: isscalar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5937
wolffd@0 5938 function bool = isscalar(x)
wolffd@0 5939
wolffd@0 5940 m= size(x);
wolffd@0 5941
wolffd@0 5942 bool = m(1) == 1 & m(2) == 1;
wolffd@0 5943
wolffd@0 5944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5945
wolffd@0 5946 %%% Subfunction: create_args %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 5947
wolffd@0 5948 function args=create_args(string,type)
wolffd@0 5949
wolffd@0 5950 arg2='';
wolffd@0 5951 i=2;
wolffd@0 5952 j=1;
wolffd@0 5953 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 5954 msize=size(getfield(getfield(get(pre_h,'UserData'),'sData'),'data'));
wolffd@0 5955
wolffd@0 5956
wolffd@0 5957 if string(i) == ':'
wolffd@0 5958 arg1=num2str(cat(2,'1:',num2str(msize(1))));
wolffd@0 5959 i=i+1;
wolffd@0 5960 j=j+length(arg1);
wolffd@0 5961 end
wolffd@0 5962
wolffd@0 5963 while string(i) ~=',' & string(i) ~=')'
wolffd@0 5964 arg1(j)=string(i);
wolffd@0 5965 i=i+1;
wolffd@0 5966 j=j+1;
wolffd@0 5967 end
wolffd@0 5968
wolffd@0 5969
wolffd@0 5970
wolffd@0 5971 if string(i) ==','
wolffd@0 5972 j=1;
wolffd@0 5973 i=i+1;
wolffd@0 5974 if string(i)==':'
wolffd@0 5975 switch type
wolffd@0 5976 case 'x'
wolffd@0 5977 arg2='1';
wolffd@0 5978 case 'cs'
wolffd@0 5979 arg2=num2str(get_indices);
wolffd@0 5980 case 'D'
wolffd@0 5981 arg2=num2str(cat(2,'1:',num2str(msize(2))));
wolffd@0 5982 end
wolffd@0 5983 i=i+1;
wolffd@0 5984 j=j+length(arg2);
wolffd@0 5985 end
wolffd@0 5986
wolffd@0 5987 while string(i) ~= ')'
wolffd@0 5988 arg2(j)=string(i);
wolffd@0 5989 j=j+1;
wolffd@0 5990 i=i+1;
wolffd@0 5991 end
wolffd@0 5992 end
wolffd@0 5993
wolffd@0 5994
wolffd@0 5995 args{1}=arg1;
wolffd@0 5996 if ~isempty(arg2)
wolffd@0 5997 args{2} = arg2;
wolffd@0 5998 end
wolffd@0 5999
wolffd@0 6000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6001
wolffd@0 6002 function [str,skip] = check_token(string,evaltype)
wolffd@0 6003
wolffd@0 6004 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 6005
wolffd@0 6006 tmp_string=string;
wolffd@0 6007 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6008 skip=length(s);
wolffd@0 6009
wolffd@0 6010 if strcmp(t,'c')
wolffd@0 6011 if isempty(get(getfield(get(pre_h,'UserData'),'comp_names_h'),'Value'))
wolffd@0 6012 errordlg('There are no components chosen.');
wolffd@0 6013 str='error';
wolffd@0 6014 return;
wolffd@0 6015 end
wolffd@0 6016 index=getfield(get_indices,{1});
wolffd@0 6017 str=cat(2,'[',num2str(index),']');
wolffd@0 6018 if skip == length(tmp_string)
wolffd@0 6019 return;
wolffd@0 6020 end
wolffd@0 6021 tmp_string=tmp_string(skip+1:length(tmp_string));
wolffd@0 6022 [t,s] = give_token(tmp_string,evaltype);
wolffd@0 6023 if ~strcmp(t,'(')
wolffd@0 6024 return;
wolffd@0 6025 end
wolffd@0 6026 [args,skip2] = get_args(tmp_string(length(s)+1:length(tmp_string)),'c',...
wolffd@0 6027 evaltype);
wolffd@0 6028 skip=skip+skip2+2;
wolffd@0 6029 if strcmp(args,'error')
wolffd@0 6030 str = 'error'
wolffd@0 6031 return;
wolffd@0 6032 elseif ~strcmp(args,'all')
wolffd@0 6033 str=cat(2,'getfield(',str,',',args,')');
wolffd@0 6034 else
wolffd@0 6035 str=cat(2,'getfield(',str,',{[1]})');
wolffd@0 6036 end
wolffd@0 6037 elseif strcmp(t,'cs')
wolffd@0 6038 if isempty(get(getfield(get(pre_h,'UserData'),'comp_names_h'),'Value'))
wolffd@0 6039 errordlg('There are no components chosen.');
wolffd@0 6040 str='error';
wolffd@0 6041 return;
wolffd@0 6042 end
wolffd@0 6043 str =cat(2,'[',num2str(get_indices),']');
wolffd@0 6044 if length(s) == length(string)
wolffd@0 6045 return;
wolffd@0 6046 end
wolffd@0 6047 tmp_string=tmp_string(1+length(s):length(string));
wolffd@0 6048 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6049 if ~strcmp(t,'(')
wolffd@0 6050 return;
wolffd@0 6051 else
wolffd@0 6052 [args,skip2]=get_args(tmp_string(1+length(s):length(tmp_string)),'cs',...
wolffd@0 6053 evaltype);
wolffd@0 6054 skip=2+skip+skip2;
wolffd@0 6055 if strcmp(args,'error')
wolffd@0 6056 str='error';
wolffd@0 6057 return;
wolffd@0 6058 elseif ~strcmp(args,'all')
wolffd@0 6059 str = cat(2,'getfield(',str,',',args,')');
wolffd@0 6060 else
wolffd@0 6061 tmp_str=str;
wolffd@0 6062 str=cat(2,'[getfield(',str,',','{1})');
wolffd@0 6063 for i=2:length(get_indices)
wolffd@0 6064 str=cat(2,str,';getfield(',tmp_str,',',sprintf('{%d})',i));
wolffd@0 6065 end
wolffd@0 6066 str=cat(2,str,']');
wolffd@0 6067 end
wolffd@0 6068 end
wolffd@0 6069 elseif strcmp(t,'dim')
wolffd@0 6070 ind1=getfield(size(getfield(getfield(get(pre_h,'UserData'),'sData'),'data')),{2});
wolffd@0 6071 str=cat(2,'[',num2str(ind1),']');
wolffd@0 6072 if length(s)==length(string)
wolffd@0 6073 return;
wolffd@0 6074 end
wolffd@0 6075 tmp_string=string(1+length(s):length(string));
wolffd@0 6076 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6077 if ~strcmp(t,'(')
wolffd@0 6078 return;
wolffd@0 6079 end
wolffd@0 6080 skip=1+skip+length(s);
wolffd@0 6081 [args,skip2]=get_args(tmp_string(1+length(s):length(tmp_string)),'dim',...
wolffd@0 6082 evaltype);
wolffd@0 6083 if strcmp(args,'error')
wolffd@0 6084 str = 'error';
wolffd@0 6085 return;
wolffd@0 6086 else
wolffd@0 6087 skip=skip+skip2;
wolffd@0 6088 if ~strcmp(args,'all')
wolffd@0 6089 str=cat(2,'getfield(',str,',',args,')');
wolffd@0 6090 end
wolffd@0 6091 end
wolffd@0 6092
wolffd@0 6093 elseif strcmp(t,'dlen')
wolffd@0 6094 ind1=getfield(size(getfield(getfield(get(pre_h,'UserData'),'sData'),'data')),{1});
wolffd@0 6095 str=cat(2,'[',num2str(ind1),']');
wolffd@0 6096 if length(s)==length(string)
wolffd@0 6097 return;
wolffd@0 6098 end
wolffd@0 6099 tmp_string=string(1+length(s):length(string));
wolffd@0 6100 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6101 if ~strcmp(t,'(')
wolffd@0 6102 return;
wolffd@0 6103 end
wolffd@0 6104 skip=skip+length(s);
wolffd@0 6105 [args,skip2]=get_args(tmp_string(1+length(s):length(tmp_string)),'dlen',...
wolffd@0 6106 evaltype);
wolffd@0 6107 if strcmp(args,'error')
wolffd@0 6108 str='error';
wolffd@0 6109 return;
wolffd@0 6110 else
wolffd@0 6111 skip=1+skip+skip2;
wolffd@0 6112 if ~strcmp(args,'all')
wolffd@0 6113 str=cat(2,'getfield(',str,',',args,')');
wolffd@0 6114 end
wolffd@0 6115 end
wolffd@0 6116
wolffd@0 6117 elseif strcmp(t,'x')
wolffd@0 6118 if isempty(get(getfield(get(pre_h,'UserData'),'comp_names_h'),'Value'))
wolffd@0 6119 errordlg('There are not components chosen.');
wolffd@0 6120 str='error';
wolffd@0 6121 return;
wolffd@0 6122 end
wolffd@0 6123 len=getfield(size(getfield(getfield(get(pre_h,'UserData'),...
wolffd@0 6124 'sData'),'data')),{1});
wolffd@0 6125 index=num2str(getfield(get_indices,{1}));
wolffd@0 6126 h_str='findobj(get(0,''Children''),''Tag'',''Preprocess'')';
wolffd@0 6127 get_str=cat(2,'getfield(get(',h_str,',''UserData''),''sData'')');
wolffd@0 6128 get_str=cat(2,'getfield(',get_str,',''data'')');
wolffd@0 6129 str=cat(2,'getfield(',get_str,',{[1:',num2str(len),'],',index,'})');
wolffd@0 6130 if length(s) == length(string)
wolffd@0 6131 return;
wolffd@0 6132 end
wolffd@0 6133 tmp_string=string(1+length(s):length(string));
wolffd@0 6134 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6135 if ~strcmp(t,'(');
wolffd@0 6136 return;
wolffd@0 6137 end
wolffd@0 6138 skip=skip+length(s);
wolffd@0 6139 [args,skip2]=get_args(tmp_string(1+length(s):length(tmp_string)),'x',...
wolffd@0 6140 evaltype);
wolffd@0 6141 if strcmp(args,'error')
wolffd@0 6142 str = 'error';
wolffd@0 6143 return;
wolffd@0 6144 else
wolffd@0 6145 skip=1+skip+skip2;
wolffd@0 6146 if ~strcmp(args,'all')
wolffd@0 6147 str=cat(2,'getfield(',str,',',args,')');
wolffd@0 6148 end
wolffd@0 6149 end
wolffd@0 6150
wolffd@0 6151 elseif strcmp(t,'xs')
wolffd@0 6152 if isempty(get(getfield(get(pre_h,'UserData'),'comp_names_h'),'Value'))
wolffd@0 6153 errordlg('There are not components chosen.');
wolffd@0 6154 str='error';
wolffd@0 6155 return;
wolffd@0 6156 end
wolffd@0 6157 len=getfield(size(getfield(getfield(get(pre_h,'UserData'),...
wolffd@0 6158 'sData'),'data')),{1});
wolffd@0 6159 index=get_indices;
wolffd@0 6160 index=cat(2,'[',num2str(index),']');
wolffd@0 6161 h_str='findobj(get(0,''Children''),''Tag'',''Preprocess'')';
wolffd@0 6162 get_str=cat(2,'getfield(get(',h_str,',''UserData''),''sData'')');
wolffd@0 6163 get_str=cat(2,'getfield(',get_str,',''data'')');
wolffd@0 6164 str=cat(2,'getfield(',get_str,',{[1:',num2str(len),'],',index,'})');
wolffd@0 6165 if length(s) == length(string)
wolffd@0 6166 return;
wolffd@0 6167 end
wolffd@0 6168 tmp_string=string(1+length(s):length(string));
wolffd@0 6169 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6170 if ~strcmp(t,'(')
wolffd@0 6171 return;
wolffd@0 6172 end
wolffd@0 6173 skip=1+skip+length(s);
wolffd@0 6174
wolffd@0 6175 [args,skip2]=get_args(tmp_string(1+length(s):length(tmp_string)),'xs',...
wolffd@0 6176 evaltype);
wolffd@0 6177 if strcmp(args,'error')
wolffd@0 6178 str = 'error';
wolffd@0 6179 return;
wolffd@0 6180 elseif ~strcmp(args,'all')
wolffd@0 6181 str=cat(2,'getfield(',str,',',args,')');
wolffd@0 6182 skip=skip+skip2;
wolffd@0 6183 else
wolffd@0 6184 skip=skip+skip2;
wolffd@0 6185 [dlen,dim]=size(eval(str));
wolffd@0 6186 tmp_str=str;
wolffd@0 6187 str=cat(2,'[','getfield(',tmp_str,sprintf(',{1:%d,1})',dlen));
wolffd@0 6188 for i=2:dim
wolffd@0 6189 tmp=sprintf(',{1:%d,%d})',dlen,dim);
wolffd@0 6190 str=cat(2,str,';','getfield(',tmp_str,tmp);
wolffd@0 6191 end
wolffd@0 6192 str=cat(2,str,']');
wolffd@0 6193 end
wolffd@0 6194 elseif strcmp(t,'D')
wolffd@0 6195 get_h='findobj(get(0,''Children''),''Tag'',''Preprocess'')';
wolffd@0 6196 str=cat(2,'getfield(getfield(get(',get_h,',''UserData''),''sData''),''data'')');
wolffd@0 6197
wolffd@0 6198 if length(s) >= length(tmp_string)
wolffd@0 6199 return;
wolffd@0 6200 end
wolffd@0 6201
wolffd@0 6202 tmp_string=tmp_string(1+length(s):length(tmp_string));
wolffd@0 6203 [t,s]=give_token(tmp_string,evaltype);
wolffd@0 6204 if ~strcmp(t,'(')
wolffd@0 6205 return;
wolffd@0 6206 else
wolffd@0 6207 tmp_string=tmp_string(1+length(s):length(tmp_string));
wolffd@0 6208 skip = skip+length(s);
wolffd@0 6209 [args, skip2]=get_args(tmp_string,'D',evaltype);
wolffd@0 6210 if strcmp(args,'error')
wolffd@0 6211 str='error';
wolffd@0 6212 return;
wolffd@0 6213 elseif ~strcmp(args,'all')
wolffd@0 6214 str=cat(2,'getfield(',str,',',args,')');
wolffd@0 6215 skip=1+skip+skip2;
wolffd@0 6216 else
wolffd@0 6217 skip=1+skip+skip2;
wolffd@0 6218 [dlen,dim]=size(eval(str));
wolffd@0 6219 tmp_str=str;
wolffd@0 6220 str=cat(2,'[getfield(',str,sprintf(',{1:%d,1})',dlen));
wolffd@0 6221 for i=2:dim
wolffd@0 6222 tmp=sprintf(',{1:%d,%d}',dlen,i);
wolffd@0 6223 str=cat(2,str,';getfield(',tmp_str,tmp,')');
wolffd@0 6224 end
wolffd@0 6225 str=cat(2,str,']');
wolffd@0 6226 end
wolffd@0 6227 end
wolffd@0 6228 else
wolffd@0 6229 if strcmp(t,'(')
wolffd@0 6230 str = t;
wolffd@0 6231 str2='';
wolffd@0 6232 tmp_string=tmp_string(1+length(s):length(tmp_string));
wolffd@0 6233 while ~strcmp(str2,')') & ~isempty(tmp_string)
wolffd@0 6234 [str2,skip2]=check_token(tmp_string,evaltype);
wolffd@0 6235 if strcmp(str2,'error')
wolffd@0 6236 str='error';
wolffd@0 6237 return;
wolffd@0 6238 end
wolffd@0 6239 skip=skip+skip2;
wolffd@0 6240 tmp_string=tmp_string(skip2+1:length(tmp_string));
wolffd@0 6241 str=cat(2,str,str2);
wolffd@0 6242 end
wolffd@0 6243 if ~strcmp(str2,')')
wolffd@0 6244 str = 'error';
wolffd@0 6245 end
wolffd@0 6246 else
wolffd@0 6247 str = s;
wolffd@0 6248 end
wolffd@0 6249 end
wolffd@0 6250
wolffd@0 6251 %%% Subfunction: get_args %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6252
wolffd@0 6253 function [str,skip] = get_args(string,flag,evaltype)
wolffd@0 6254
wolffd@0 6255 res_words=[{'D'};{'c'};{'cs'};{'dim'};{'dlen'};{'x'};{'xs'}];
wolffd@0 6256 NOTALL=1;
wolffd@0 6257 if isempty(string)
wolffd@0 6258 str='error'
wolffd@0 6259 skip=[];
wolffd@0 6260 return;
wolffd@0 6261 end
wolffd@0 6262 [t,s] = give_token(string,evaltype);
wolffd@0 6263
wolffd@0 6264
wolffd@0 6265 skip=length(s);
wolffd@0 6266 if any(strcmp(t,res_words));
wolffd@0 6267 [str,skip2] = check_token(string,evaltype);
wolffd@0 6268 string=string(1+length(s):length(string));
wolffd@0 6269 str=cat(2,'{[',str);
wolffd@0 6270 [t,s]=give_token(string,evaltype);
wolffd@0 6271 elseif t==')' | t==','
wolffd@0 6272 str = 'error';
wolffd@0 6273 return;
wolffd@0 6274 elseif strcmp(t,':');
wolffd@0 6275 if length(s) == length(string)
wolffd@0 6276 str='error';
wolffd@0 6277 return;
wolffd@0 6278 end
wolffd@0 6279 [t,s]=give_token(string(1+length(s):length(string)),evaltype);
wolffd@0 6280 if t == ')'
wolffd@0 6281 str = 'all';
wolffd@0 6282 return;
wolffd@0 6283 end
wolffd@0 6284 switch flag
wolffd@0 6285 case {'c','cs','dim','dlen'}
wolffd@0 6286 str= '{[1';
wolffd@0 6287 otherwise
wolffd@0 6288 str=cat(2,'{[',get_all('vect'));
wolffd@0 6289 end
wolffd@0 6290 NOTALL=0;
wolffd@0 6291 string=string(1+length(s):length(string));
wolffd@0 6292 [t,s]=give_token(string,evaltype);
wolffd@0 6293 skip=skip+1;
wolffd@0 6294 else
wolffd@0 6295 str = cat(2,'{[',s);
wolffd@0 6296 end
wolffd@0 6297 str2 =[];
wolffd@0 6298
wolffd@0 6299
wolffd@0 6300 if ~strcmp(t,',') & ~strcmp(t,')')
wolffd@0 6301 skip=skip-length(s);
wolffd@0 6302 end
wolffd@0 6303
wolffd@0 6304
wolffd@0 6305
wolffd@0 6306 while ~strcmp(t,',') & ~strcmp(t,')') & NOTALL;
wolffd@0 6307 str=cat(2,str,str2);
wolffd@0 6308 [t,s] = give_token(string,evaltype);
wolffd@0 6309 if length(s) == length(string)
wolffd@0 6310 str = 'error';
wolffd@0 6311 return;
wolffd@0 6312 end
wolffd@0 6313 string=string(1+length(s):length(string));
wolffd@0 6314 skip=skip+length(s);
wolffd@0 6315 [t,s]=give_token(string,evaltype);
wolffd@0 6316 if length(s) == length(string) & ~strcmp(t,')')
wolffd@0 6317 str = 'error';
wolffd@0 6318 return;
wolffd@0 6319 end
wolffd@0 6320
wolffd@0 6321 [str2,foo]=check_token(string,evaltype);
wolffd@0 6322 end
wolffd@0 6323
wolffd@0 6324 if NOTALL & ~strcmp(t,')')
wolffd@0 6325 skip=skip+1;
wolffd@0 6326 end
wolffd@0 6327
wolffd@0 6328 if strcmp(t,')')
wolffd@0 6329 str=cat(2,str,']}');
wolffd@0 6330 return
wolffd@0 6331 end
wolffd@0 6332
wolffd@0 6333 str=cat(2,str,']',',','[');
wolffd@0 6334 str2 = [];
wolffd@0 6335
wolffd@0 6336
wolffd@0 6337 [t,s] = give_token(string,evaltype);
wolffd@0 6338 if strcmp(t,')')
wolffd@0 6339 str = 'error'
wolffd@0 6340 return;
wolffd@0 6341 end
wolffd@0 6342 NOTALL=1;
wolffd@0 6343 string=string(1+length(s):length(string));
wolffd@0 6344 [t,s]=give_token(string,evaltype);
wolffd@0 6345 if strcmp(t,':');
wolffd@0 6346 switch flag
wolffd@0 6347 case {'c','dim','dlen','x'}
wolffd@0 6348 str=cat(2,str,'1');
wolffd@0 6349 case 'D'
wolffd@0 6350 str=cat(2,str,get_all('comp'));
wolffd@0 6351 case {'cs','xs'}
wolffd@0 6352 str=cat(2,str,'1:',num2str(length(get_indices)));
wolffd@0 6353 end
wolffd@0 6354 NOTALL=0;
wolffd@0 6355 if length(s) == length(string)
wolffd@0 6356 str='error';
wolffd@0 6357 return;
wolffd@0 6358 end
wolffd@0 6359 string=string(1+length(s):length(string));
wolffd@0 6360 [t,s]=give_token(string,evaltype);
wolffd@0 6361 end
wolffd@0 6362
wolffd@0 6363 if ~strcmp(t,')') & NOTALL
wolffd@0 6364 skip=skip-1;
wolffd@0 6365 end
wolffd@0 6366
wolffd@0 6367 while ~strcmp(t,')') & NOTALL
wolffd@0 6368 str=cat(2,str,str2);
wolffd@0 6369 skip=skip+length(s);
wolffd@0 6370 if length(s) == length(string) & ~strcmp(t,')')
wolffd@0 6371 str='error';
wolffd@0 6372 return;
wolffd@0 6373 end
wolffd@0 6374 [str2,foo]=check_token(string,evaltype);
wolffd@0 6375 string=string(1+length(s):length(string));
wolffd@0 6376 [t,s]=give_token(string,evaltype);
wolffd@0 6377 end
wolffd@0 6378 if ~strcmp(t,')')
wolffd@0 6379 str='error';
wolffd@0 6380 return;
wolffd@0 6381 end
wolffd@0 6382
wolffd@0 6383
wolffd@0 6384 str=cat(2,str,str2,']}');
wolffd@0 6385 skip=skip+length(s);
wolffd@0 6386
wolffd@0 6387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6388
wolffd@0 6389 %%% Subfunction: get_all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6390
wolffd@0 6391 function str=get_all(vect_or_comp)
wolffd@0 6392
wolffd@0 6393 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 6394
wolffd@0 6395 switch vect_or_comp
wolffd@0 6396 case 'vect'
wolffd@0 6397 dim=getfield(size(getfield(getfield(get(pre_h,'UserData'),...
wolffd@0 6398 'sData'),'data')),{1});
wolffd@0 6399 str=cat(2,'1:',num2str(dim));
wolffd@0 6400 case 'comp'
wolffd@0 6401 dim=getfield(size(getfield(getfield(get(pre_h,'UserData'),...
wolffd@0 6402 'sData'),'data')),{2});
wolffd@0 6403 str=cat(2,'1:',num2str(dim));
wolffd@0 6404 end
wolffd@0 6405
wolffd@0 6406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6407
wolffd@0 6408 function [token,str]=give_token(string,evaltype)
wolffd@0 6409
wolffd@0 6410 n=length(string);
wolffd@0 6411 i=1;
wolffd@0 6412 char=string(i);
wolffd@0 6413
wolffd@0 6414 switch analyze_char(string(i));
wolffd@0 6415 case 'num'
wolffd@0 6416 token='num';
wolffd@0 6417 while i <= n & strcmp('num',analyze_char(string(i)))
wolffd@0 6418 str(i)=string(i);
wolffd@0 6419 i=i+1;
wolffd@0 6420 end
wolffd@0 6421 case 'other'
wolffd@0 6422 switch string(i)
wolffd@0 6423 case ':'
wolffd@0 6424 token = ':';
wolffd@0 6425 case ','
wolffd@0 6426 token = ',';
wolffd@0 6427 case '('
wolffd@0 6428 token = '(';
wolffd@0 6429 case ')'
wolffd@0 6430 token = ')';
wolffd@0 6431 case '='
wolffd@0 6432 token = '=';
wolffd@0 6433 otherwise
wolffd@0 6434 token='other';
wolffd@0 6435 end
wolffd@0 6436 str=string(i);
wolffd@0 6437 case 'alpha'
wolffd@0 6438 while i <= n & strcmp('alpha',analyze_char(string(i)))
wolffd@0 6439 str(i)=string(i);
wolffd@0 6440 i=i+1;
wolffd@0 6441 end
wolffd@0 6442 token = find_res_word(str,evaltype);
wolffd@0 6443 end
wolffd@0 6444
wolffd@0 6445 %%% Subfunction: analyze_char %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6446
wolffd@0 6447 function type=analyze_char(char)
wolffd@0 6448
wolffd@0 6449
wolffd@0 6450 if ((char-0) >= ('0'-0) & (char-0) <= ('9'-0))
wolffd@0 6451 type='num';
wolffd@0 6452 elseif ((char-0) >= ('a'-0) & (char-0) <= ('z'-0)) ...
wolffd@0 6453 | ((char-0) >= ('A'-0) & (char-0) <= ('Z'-0))
wolffd@0 6454 type='alpha';
wolffd@0 6455 else
wolffd@0 6456 type='other';
wolffd@0 6457 end
wolffd@0 6458
wolffd@0 6459
wolffd@0 6460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6461
wolffd@0 6462 %%% Subfunction: find_res_word %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6463
wolffd@0 6464 function token = find_res_word(string,evaltype)
wolffd@0 6465
wolffd@0 6466 reswords=[{'D'};{'c'};{'cs'};{'dim'};{'dlen'};{'x'};{'xs'};{'other'}];
wolffd@0 6467
wolffd@0 6468 for i=1:length(reswords);
wolffd@0 6469 token=reswords{i};
wolffd@0 6470 if strcmp(string,reswords{i})
wolffd@0 6471 if strcmp(evaltype,'single') & ~strcmp(string,'x')
wolffd@0 6472 token = 'other';
wolffd@0 6473 end
wolffd@0 6474 return;
wolffd@0 6475 end
wolffd@0 6476 end
wolffd@0 6477
wolffd@0 6478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6479
wolffd@0 6480 function close_func(varargin)
wolffd@0 6481
wolffd@0 6482 switch varargin{1}
wolffd@0 6483 case 'close_c'
wolffd@0 6484 str='% Closing the ''Clipping'' -window...';
wolffd@0 6485 clip_h=findobj(get(0,'Children'),'Tag','Clipping');
wolffd@0 6486 close(clip_h);
wolffd@0 6487 case 'close_sD'
wolffd@0 6488 str='% Closing the ''Data Set Management'' -window...';
wolffd@0 6489 sD_h=findobj(get(0,'Children'),'Tag','Management');
wolffd@0 6490 close(sD_h);
wolffd@0 6491 case 'close_w'
wolffd@0 6492 str='% Closing the ''Windowed'' -window...';
wolffd@0 6493 win_h=findobj(get(0,'Children'),'Tag','Window');
wolffd@0 6494 close(win_h);
wolffd@0 6495 case 'close_s'
wolffd@0 6496 str='% Closing the ''Select'' -window...';
wolffd@0 6497 sel_h=findobj(get(0,'Children'),'Tag','Select');
wolffd@0 6498 close(sel_h);
wolffd@0 6499 case 'close_d'
wolffd@0 6500 str='% Closing the ''Delay'' -window...';
wolffd@0 6501 del_h=findobj(get(0,'Children'),'Tag','Delay');
wolffd@0 6502 close(del_h);
wolffd@0 6503 end
wolffd@0 6504
wolffd@0 6505 if nargin ~= 2
wolffd@0 6506 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 6507 preh_udata=get(pre_h,'UserData');
wolffd@0 6508 str2=cat(2,'preprocess(''',varargin{1},''',''foo'');');
wolffd@0 6509 preh_udata.LOG{length(preh_udata.LOG)+1}=str;
wolffd@0 6510 preh_udata.LOG{length(preh_udata.LOG)+1}=str2;
wolffd@0 6511 set(pre_h,'UserData',preh_udata);
wolffd@0 6512 end
wolffd@0 6513
wolffd@0 6514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6515
wolffd@0 6516 function log_file
wolffd@0 6517
wolffd@0 6518 answer=inputdlg('Give the name of the outputfile:','LOG function',1,...
wolffd@0 6519 {'log_function'});
wolffd@0 6520
wolffd@0 6521 if isempty(answer)
wolffd@0 6522 return;
wolffd@0 6523 end
wolffd@0 6524
wolffd@0 6525
wolffd@0 6526 tmp=clock;
wolffd@0 6527 str =cat(2,'% Created: ',...
wolffd@0 6528 date,...
wolffd@0 6529 ' ',sprintf('%d:%d\n%\n\n',tmp(4),tmp(5)));
wolffd@0 6530 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 6531 LOG=getfield(get(pre_h,'UserData'),'LOG');
wolffd@0 6532 file=cat(2,pwd,'/',answer{1},'.m');
wolffd@0 6533 fid =fopen(file,'w');
wolffd@0 6534
wolffd@0 6535 arg=LOG{2}(12:length(LOG{2})-2);
wolffd@0 6536 fprintf(fid,'%s\n \n',cat(2,'function ',answer{1},'(',arg,')'));
wolffd@0 6537 fprintf(fid,'%s\n',str);
wolffd@0 6538 for i=1:length(LOG)
wolffd@0 6539 fprintf(fid,'%s\n',LOG{i});
wolffd@0 6540 end
wolffd@0 6541 fclose(fid);
wolffd@0 6542 disp(sprintf('LOG-file ''%s'' is done.',file));
wolffd@0 6543
wolffd@0 6544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6545
wolffd@0 6546 function get_selected_inds(varargin)
wolffd@0 6547
wolffd@0 6548 if nargin == 1
wolffd@0 6549 LOG=1;
wolffd@0 6550 answer = {varargin{1}};
wolffd@0 6551 else
wolffd@0 6552 LOG=0;
wolffd@0 6553 end
wolffd@0 6554
wolffd@0 6555 selected=getfield(get(gcf,'UserData'),'selected_vects');
wolffd@0 6556 if ~LOG
wolffd@0 6557 answer=inputdlg('Give the name of the output variable:',...
wolffd@0 6558 '',1,{'indices'});
wolffd@0 6559 end
wolffd@0 6560
wolffd@0 6561 if isempty(answer) | isempty(answer{1})
wolffd@0 6562 return;
wolffd@0 6563 else
wolffd@0 6564 assignin('base',answer{1},selected);
wolffd@0 6565 disp(cat(2,'Indices of the selected vectors are set to the workspace ',...
wolffd@0 6566 sprintf(' as ''%s''.',answer{1})));
wolffd@0 6567 if ~LOG
wolffd@0 6568 data=get(gcf,'UserData');
wolffd@0 6569 data.LOG{length(data.LOG)+1}=...
wolffd@0 6570 '% Saving indices of the selected vectors to the workspace.';
wolffd@0 6571 data.LOG{length(data.LOG)+1}=cat(2,'preprocess(''get_inds'',',...
wolffd@0 6572 '''',answer{1},''');');
wolffd@0 6573 set(gcf,'UserData',data);
wolffd@0 6574 end
wolffd@0 6575 end
wolffd@0 6576
wolffd@0 6577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6578
wolffd@0 6579 function no_of_selected(varargin)
wolffd@0 6580
wolffd@0 6581 if nargin == 1
wolffd@0 6582 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 6583 set(0,'CurrentFigure',pre_h);
wolffd@0 6584 LOG = 1;
wolffd@0 6585 else
wolffd@0 6586 LOG = 0;
wolffd@0 6587 end
wolffd@0 6588
wolffd@0 6589 results_h=getfield(get(gcf,'UserData'),'results_h');
wolffd@0 6590 no=length(getfield(get(gcf,'UserData'),'selected_vects'));
wolffd@0 6591 str={sprintf('Number of selected vectors: %d\n', no)};
wolffd@0 6592 set(results_h,'String',str,'HorizontalAlignment','left');
wolffd@0 6593
wolffd@0 6594 if ~LOG
wolffd@0 6595 data=get(gcf,'UserData');
wolffd@0 6596 data.LOG{length(data.LOG)+1}='% Number of selected vectors';
wolffd@0 6597 data.LOG{length(data.LOG)+1}='preprocess(''no_of_sel'',''foo'');';
wolffd@0 6598 set(gcf,'UserData',data);
wolffd@0 6599 end
wolffd@0 6600
wolffd@0 6601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6602
wolffd@0 6603 function select_all_comps(varargin)
wolffd@0 6604
wolffd@0 6605 if nargin == 1
wolffd@0 6606 pre_h=findobj(get(0,'Children'),'Tag','Preprocess');
wolffd@0 6607 set(0,'CurrentFigure',pre_h);
wolffd@0 6608 LOG=1;
wolffd@0 6609 else
wolffd@0 6610 LOG=0;
wolffd@0 6611 end
wolffd@0 6612
wolffd@0 6613 comp_names_h=getfield(get(gcf,'UserData'),'comp_names_h');
wolffd@0 6614
wolffd@0 6615 set(comp_names_h,'Value',[1:length(get(comp_names_h,'String'))]);
wolffd@0 6616 sel_comp;
wolffd@0 6617
wolffd@0 6618 if ~LOG
wolffd@0 6619 data=get(gcf,'UserData');
wolffd@0 6620 data.LOG{length(data.LOG)+1}='% Select all components';
wolffd@0 6621 data.LOG{length(data.LOG)+1}='preprocess(''sel_all_comps'',''foo'');';
wolffd@0 6622 set(gcf,'UserData',data);
wolffd@0 6623 end
wolffd@0 6624
wolffd@0 6625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wolffd@0 6626
wolffd@0 6627 function code=write_log_code(indices,arg1,arg2,arg3,arg4,arg5,arg6);
wolffd@0 6628
wolffd@0 6629 str=textwrap({num2str(indices)},500);
wolffd@0 6630
wolffd@0 6631 code{1}=sprintf('inds=[];');
wolffd@0 6632 for i=1:length(str);
wolffd@0 6633 code{i+1}=sprintf(' inds=cat(2,inds,[%s]);',str{i});
wolffd@0 6634 end
wolffd@0 6635 str=cat(2,'preprocess(''''clip_data'''',''''',arg1,' ',num2str(arg2),' ',...
wolffd@0 6636 num2str(arg3),' ',num2str(arg4),...
wolffd@0 6637 ' ',num2str(arg5),' ',num2str(arg6),' ');
wolffd@0 6638 code{length(code)+1}=cat(2,'eval(cat(2,',...
wolffd@0 6639 '''',str,'''',...
wolffd@0 6640 ',num2str(inds),'''''');''));');
wolffd@0 6641
wolffd@0 6642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%