0001 function varargout = current_gui(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 fig = varargin{1};
0053 key = varargin{2};
0054 data = guidata(fig);
0055
0056 switch(key)
0057
0058
0059
0060
0061 case 'set_parm'
0062 current_parm = varargin{3};
0063 data = set_parm_gui(data, current_parm);
0064 data.current_parm = current_parm;
0065 case 'get_parm'
0066 varargout{1} = data.current_parm(data);
0067
0068
0069
0070
0071
0072 case 'callback'
0073 hObj = varargin{3};
0074 data = callback(data.H, hObj, data);
0075 if ~ishandle(fig), return; end
0076 current_parm = get_parm_gui(data);
0077 guidata(fig, data);
0078 current_gui(fig, 'merge_parm', current_parm);
0079 case 'merge_parm'
0080 merge_parm = varargin{3};
0081 parm_names = fieldnames(merge_parm);
0082 for k=1:length(parm_names)
0083 data.current_parm.(parm_names{k}) = merge_parm.(parm_names{k});
0084 end
0085 end
0086
0087
0088 guidata(fig, data);
0089
0090 function [data] = set_parm_gui(data, current_parm)
0091
0092
0093
0094
0095
0096
0097
0098 H = data.H;
0099
0100
0101 if isempty(current_parm) || ~exist('current_parm', 'var')
0102 current_parm = vb_set_current_parm;
0103 end
0104
0105
0106 if isfield(current_parm, 'bayesfile') && ~isempty(current_parm.bayesfile)
0107 proj_root = get(H.proj_root_edit, 'String');
0108 if isfield(current_parm, 'megfile')
0109 megfile = current_parm.megfile;
0110 else
0111 megfile = [];
0112 end
0113 [err, t_parm] = set_result_file(H, proj_root, current_parm.bayesfile, megfile);
0114 if ~err, data.time_parm = t_parm; end
0115 end
0116
0117
0118 if isfield(current_parm, 'currfile') && ~isempty(current_parm.currfile)
0119 [path_name, file_name, ext] = fileparts(current_parm.currfile);
0120 set(H.save_directory_edit, 'String', path_name);
0121 set(H.current_file_edit, 'String', current_parm.currfile);
0122 update_output_filename(H);
0123 end
0124
0125
0126 if isfield(current_parm, 'trial_average') && ~isempty(current_parm.trial_average)
0127 if current_parm.trial_average == ON
0128 change_trial_average(H, ON);
0129 else
0130 change_trial_average(H, OFF);
0131 end
0132 end
0133
0134
0135 if isfield(current_parm, 'tsubsmpl') && ~isempty(current_parm.tsubsmpl)
0136 tsubsmpl = current_parm.tsubsmpl;
0137 twin_msec = [];
0138 twin_meg = [];
0139 step_time = data_len_to_time_len(...
0140 tsubsmpl(2) - tsubsmpl(1), ...
0141 data.time_parm);
0142 Nsample = length(tsubsmpl);
0143
0144 [twin_meg(1), err, err_msg] = ...
0145 subsmpl_index_to_index(tsubsmpl(1), data.time_parm);
0146 [twin_msec(1), err, err_msg] = ...
0147 vb_index_to_time(twin_meg(1), data.time_parm);
0148 [twin_meg(2), err, err_msg] = ...
0149 subsmpl_index_to_index(tsubsmpl(Nsample), data.time_parm);
0150 [twin_msec(2), err, err_msg] = ...
0151 vb_index_to_time(twin_meg(2), data.time_parm);
0152
0153 set(H.time_window_from_edit, 'String', sprintf('%.2f', twin_msec(1)));
0154 set(H.time_window_to_edit, 'String', sprintf('%.2f', twin_msec(2)));
0155 set(H.time_step_edit, 'String', sprintf('%.2f', step_time));
0156 end
0157
0158
0159 if isfield(current_parm, 'jactdir') && ~isempty(current_parm.jactdir)
0160 if ~isempty(current_parm.jactdir)
0161 set(H.jact_directory_edit, 'String', current_parm.jactdir);
0162 change_save_mode(H, SAVE_MODE_MULTIPLE);
0163 end
0164 end
0165
0166
0167 if isfield(current_parm, 'areafile') && ~isempty(current_parm.areafile)
0168 if isfield(current_parm, 'area_key')
0169 reload_gui_area_file(H, current_parm.areafile, current_parm.area_key);
0170 else
0171 reload_gui_area_file(H, current_parm.areafile);
0172 end
0173 end
0174
0175
0176 current_parm.flag = 0;
0177
0178 update_exec_button_state(H);
0179
0180
0181
0182 function current_parm = get_parm_gui(data)
0183
0184
0185
0186
0187
0188
0189 H = data.H;
0190
0191 current_parm = struct;
0192
0193
0194 current_parm.bayesfile = get(H.result_file_edit, 'String');
0195
0196
0197 meg_file = get(H.meg_file_edit, 'String');
0198 if ~isempty(meg_file)
0199 current_parm.megfile = meg_file;
0200 end
0201
0202
0203 current_file = get(H.current_file_edit, 'String');
0204 current_parm.currfile = current_file;
0205
0206
0207 if get(H.trial_average_on_button, 'Value') == 1
0208 current_parm.trial_average = ON;
0209 else
0210 current_parm.trial_average = OFF;
0211 end
0212
0213
0214 twin_subsmple = [];
0215 twin_meg = [];
0216 step_size_str = get(H.time_step_edit, 'String');
0217 twin_from_str = get(H.time_window_from_edit, 'String');
0218 twin_to_str = get(H.time_window_to_edit, 'String');
0219
0220 if ~isempty(data.time_parm)
0221
0222 step_size = time_len_to_data_len(...
0223 str2double(step_size_str),...
0224 data.time_parm);
0225
0226 [twin_meg(1), err, err_msg] = ...
0227 vb_time_to_index(str2double(twin_from_str), data.time_parm);
0228 [twin_meg(2), err, err_msg] = ...
0229 vb_time_to_index(str2double(twin_to_str), data.time_parm);
0230 [twin_subsmple(1), err, err_msg] = ...
0231 index_to_subsmpl_index(twin_meg(1), data.time_parm);
0232 [twin_subsmple(2), err, err_msg] = ...
0233 index_to_subsmpl_index(twin_meg(2), data.time_parm);
0234
0235 current_parm.tsubsmpl = [twin_subsmple(1):step_size:twin_subsmple(2)];
0236 end
0237
0238
0239 if get(H.save_file_multiple_button, 'Value') == 1
0240 current_parm.jactdir = get(H.jact_directory_edit, 'String');
0241 if isempty(current_parm.jactdir)
0242 current_parm.jactdir = '.';
0243 end
0244 end
0245
0246
0247 current_parm.areafile = get(H.area_file_edit, 'String');
0248 area_keys = get(H.area_key_listbox, 'String');
0249 if ischar(area_keys)
0250 current_parm.area_key = area_keys;
0251 else
0252 current_parm.area_key = area_keys{get(H.area_key_listbox, 'Value')};
0253 end
0254
0255
0256 current_parm.flag = 0;
0257
0258
0259
0260
0261 function [err] = exec(H, data)
0262
0263
0264
0265
0266
0267
0268 err = false;
0269
0270 proj_root = get(H.proj_root_edit, 'String');
0271 current_parm = get_parm_gui(data);
0272
0273 str = get(H.exec_push, 'String');
0274 set(H.exec_push, 'String', 'Processing...');
0275 drawnow;
0276
0277 vb_job_current(proj_root, current_parm);
0278 set(H.exec_push, 'String', 'Exec');
0279
0280
0281
0282 function [data] = callback(H, hObj, data)
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292 global vbmeg_inst;
0293 define = vbmeg_inst.const;
0294
0295 switch(hObj)
0296 case H.proj_root_push
0297 dir_name = dir_dialog(get(H.proj_root_edit, 'String'));
0298 if dir_name ~= 0
0299 set(H.proj_root_edit, 'String', dir_name);
0300 end
0301 case H.result_file_push
0302 proj_root = get(H.proj_root_edit, 'String');
0303 [dirname, fnames, cancelled] = pa_prjfile_select(proj_root, ...
0304 {define.BAYES_EXTENSION}, ...
0305 'Select current variance file');
0306 if ~cancelled
0307 result_file = [dirname, filesep, fnames{1}];
0308 [err, time_parm] = set_result_file(H, proj_root, result_file);
0309 if ~err
0310 data.time_parm = time_parm;
0311 end
0312
0313 [p_, f_, e_] = vb_get_file_parts(result_file);
0314 ix = find(f_ == '.');
0315 if ~isempty(ix)
0316 set(H.current_file_edit, 'String', ...
0317 [f_(1:ix(1)-1), define.CURRENT_EXTENSION]);
0318 end
0319 update_output_filename(H);
0320 end
0321 case H.meg_file_push
0322 proj_root = get(H.proj_root_edit, 'String');
0323 [dir fname] = pa_prjfile_select(proj_root, ...
0324 {define.MEG2_EXTENSION, define.EEG_EXTENSION}, ...
0325 'Select MEG/EEG file');
0326 if ~isempty(dir)
0327 meg_file = [dir, filesep, fname{1}];
0328 set(H.meg_file_edit, 'String', meg_file);
0329 result_file = get(H.result_file_edit, 'String');
0330 [err, time_parm] = set_result_file(H, proj_root, result_file, meg_file);
0331 if ~err
0332 data.time_parm = time_parm;
0333 end
0334 end
0335 case {H.trial_average_on_button, H.trial_average_off_button}
0336 if hObj == H.trial_average_on_button
0337 if get(H.save_file_multiple_button, 'Value')
0338 change_trial_average(H, OFF);
0339 uiwait(...
0340 msgbox(['Set Current file format = "single file" '...
0341 'before changing trial average ON.'],...
0342 'message', 'modal'));
0343 else
0344 change_trial_average(H, ON);
0345 end
0346 else
0347 change_trial_average(H, OFF);
0348 end
0349 case {H.time_window_from_edit, H.time_window_to_edit}
0350 time_value = str2double(get(hObj, 'String'));
0351 time_index = vb_time_to_index(time_value, data.time_parm);
0352 time_value = vb_index_to_time(time_index, data.time_parm);
0353 set(hObj, 'String', sprintf('%.2f', time_value));
0354 case H.select_time_window_push
0355 time_parm = data.time_parm;
0356 if isempty(time_parm)
0357 errordlg('first, set result file.', 'error');
0358 else
0359 select_time_window_time_course(H, time_parm);
0360 end
0361 case H.time_step_edit
0362 [time_len] = str2double(get(hObj, 'String'));
0363 if time_len <= 0
0364 errordlg('Time step should be positive value.', 'error');
0365 return;
0366 else
0367
0368
0369 [data_len] = time_len_to_data_len(time_len, data.time_parm);
0370 [time_len] = data_len_to_time_len(data_len, data.time_parm);
0371 set(hObj, 'String', sprintf('%.2f', time_len));
0372 end
0373 case H.area_file_push
0374 proj_root = get(H.proj_root_edit, 'String');
0375 [dirname, fnames, cancelled] = pa_prjfile_select(...
0376 proj_root, ...
0377 {define.AREA_EXTENSION}, ...
0378 'Select cortical area file');
0379 if ~cancelled
0380 area_file = [dirname '/' fnames{1}];
0381 reload_gui_area_file(H, area_file);
0382 end
0383 case H.area_file_reset_push
0384 set(H.area_file_edit, 'String', []);
0385 set(H.area_key_listbox, 'String', []);
0386 set(H.area_key_listbox, 'Value', 1);
0387 case {H.save_file_single_button, H.save_file_multiple_button}
0388 if hObj == H.save_file_single_button
0389
0390 change_save_mode(H, SAVE_MODE_SINGLE);
0391 else
0392
0393 if get(H.trial_average_on_button, 'Value')
0394 change_save_mode(H, SAVE_MODE_SINGLE);
0395 uiwait(...
0396 msgbox(['Set trial average = "OFF" ' ...
0397 'before changing Current file format to Multiple files.'] ,...
0398 'message', 'modal'));
0399 else
0400 change_save_mode(H, SAVE_MODE_MULTIPLE);
0401 end
0402 end
0403 case H.save_directory_push
0404 proj_root = get(H.proj_root_edit, 'String');
0405 [dirname, cancelled] = pa_prjdir_select(proj_root);
0406 if ~cancelled
0407 set(H.save_directory_edit, 'String', dirname);
0408 update_output_filename(H);
0409 end
0410 case H.exec_push
0411 err = exec(H, data);
0412 case H.advanced_parameter_push
0413 this = data.H.figure;
0414 if ishandle(data.adv_fig)
0415 figure(data.adv_fig);
0416 else
0417 data.adv_fig = current_gui_advanced_new(this, data.current_parm);
0418 end
0419
0420
0421 case {H.figure, H.menu_close}
0422 current_gui_delete(data.H.figure);
0423 return;
0424 case H.menu_current_timecourse_estimation
0425 url = vb_users_manual_url('Current timecourse estimation');
0426 vb_browser_show(url);
0427 end
0428
0429 update_exec_button_state(H);
0430
0431
0432
0433 function update_exec_button_state(H)
0434
0435
0436
0437 button_state = 'off';
0438 if ~isempty(get(H.result_file_edit, 'String')) & ...
0439 ~isempty(get(H.time_window_from_edit, 'String')) & ...
0440 ~isempty(get(H.time_window_to_edit, 'String')) & ...
0441 ~isempty(get(H.time_step_edit, 'String')) & ...
0442 ~isempty(get(H.save_directory_edit, 'String')) & ...
0443 ~isempty(get(H.current_file_edit, 'String'))
0444
0445 button_state = 'on';
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455 end
0456
0457 set(H.exec_push, 'Enable', button_state);
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467 function [time, err, err_msg] = vb_index_to_time(index, time_parm)
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480 time = [];
0481 err = false;
0482 err_msg = [];
0483
0484 if isempty(time_parm)
0485 err = true;
0486 err_msg = 'result file is not specified.';
0487 return;
0488 end
0489
0490 if ~( (time_parm.twin_meg(1) <= index) && (index <= time_parm.twin_meg(2)) )
0491 error('vb_index_to_time : inputted index is out of range.');
0492 end
0493
0494 time = (index - time_parm.pretrigger - 1) * (1000/time_parm.sample_freq);
0495
0496
0497
0498 function [index, err, err_msg] = vb_time_to_index(time, time_parm)
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509 index = [];
0510 err = false;
0511 err_msg = [];
0512
0513 if isempty(time_parm)
0514 err = true;
0515 err_msg = 'result file is not specified.';
0516 return;
0517 end
0518
0519 index = round(time * (time_parm.sample_freq/1000) + time_parm.pretrigger + 1);
0520
0521
0522 if index < time_parm.twin_meg(1), index = time_parm.twin_meg(1); end;
0523 if time_parm.twin_meg(2) < index, index = time_parm.twin_meg(2); end;
0524
0525
0526
0527 function [data_len, err, err_msg] = time_len_to_data_len(time_len, time_parm)
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537 data_len = [];
0538 err = false;
0539 err_msg = [];
0540
0541 if time_len <= 0;
0542 err = true;
0543 err_msg = 'Time length should be positive value.';
0544 return;
0545 end
0546 if isempty(time_parm)
0547 err = true;
0548 err_msg = 'result file is not specified.';
0549 return;
0550 end
0551
0552 data_len = ceil(time_len * (time_parm.sample_freq/1000));
0553 twin_meg = time_parm.twin_meg;
0554
0555
0556
0557 function [time_len, err, err_msg] = data_len_to_time_len(data_len, time_parm)
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570 time_len = [];
0571 err = false;
0572 err_msg = [];
0573
0574 data_len_int = double(int64(data_len));
0575 if( data_len <=0 || (data_len - data_len_int) > 0 )
0576 error('data_len_to_time_len : data_len should be positive integer.');
0577 end
0578 if isempty(time_parm)
0579 err = true;
0580 err_msg = 'result file is not specified.';
0581 return;
0582 end
0583
0584 data_len = ceil(data_len);
0585 time_len = data_len * (1000/time_parm.sample_freq);
0586
0587
0588
0589 function [subsmpl_index, err, err_msg] = index_to_subsmpl_index(index, time_parm)
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602 subsmpl_index = [];
0603 err = false;
0604 err_msg = [];
0605
0606 index_int = double(int64(index));
0607 if( index <= 0 || (index_int - index) > 0 )
0608 error('index_to_subsmpl_index : index should be positive integer.');
0609 end
0610 if isempty(time_parm)
0611 err = true;
0612 err_msg = 'result file is not specified.';
0613 return;
0614 end
0615
0616 if ~( (time_parm.twin_meg(1) <= index) && (index <= time_parm.twin_meg(2)) )
0617 error('index_to_subsmpl_index : inputted index is out of range.');
0618 end
0619 subsmpl_index = index - time_parm.twin_meg(1) + 1;
0620
0621
0622
0623 function [index, err, err_msg] = subsmpl_index_to_index(subsmpl_index, time_parm);
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636 index = [];
0637 err = false;
0638 err_msg = [];
0639
0640 subsmpl_int = double(int64(subsmpl_index));
0641 if( subsmpl_index <= 0 || (subsmpl_index - subsmpl_int) > 0 )
0642 error('subsmpl_index_to_index : subsmple_index should be positive integer.');
0643 end
0644 if isempty(time_parm)
0645 err = true;
0646 err_msg = 'result file is not specified.';
0647 return;
0648 end
0649
0650 index = ceil(subsmpl_index) + time_parm.twin_meg(1) - 1;
0651 if ~( (time_parm.twin_meg(1) <= index) && (index <= time_parm.twin_meg(2)) )
0652 error('subsmpl_index_to_index : inputted subsmpl_index is out of range.');
0653 end
0654
0655
0656
0657 function [err, time_parm] = set_result_file(H, proj_root, result_file, meg_file)
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669 err = false;
0670
0671
0672 if ~exist('meg_file', 'var')
0673 meg_file = [];
0674 end
0675 [time_parm, err, err_msg] = read_time_parameters(proj_root, result_file, meg_file);
0676 if err
0677 errordlg(['result file read error occured -- detail :' err_msg], 'error');
0678 else
0679
0680
0681
0682
0683
0684 set(H.result_file_edit, 'String', result_file);
0685
0686
0687 [time] = vb_index_to_time(time_parm.twin_meg(1), time_parm);
0688 set(H.time_window_from_edit, 'String', sprintf('%.2f', time));
0689 [time] = vb_index_to_time(time_parm.twin_meg(2), time_parm);
0690 set(H.time_window_to_edit, 'String', sprintf('%.2f', time));
0691
0692
0693 [time_len] = data_len_to_time_len(1, time_parm);
0694 set(H.time_step_edit, 'String', num2str(time_len-0.001));
0695
0696
0697 set(H.meg_file_edit, 'String', time_parm.meg_file);
0698 set(H.meg_file_edit, 'Enable', 'on');
0699 set(H.meg_file_push, 'Enable', 'on');
0700 end
0701
0702
0703
0704 function [time_parm, err, err_msg] = read_time_parameters(proj_root, result_file, meg_file)
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716 time_parm = [];
0717 err = false;
0718 err_msg = [];
0719 if ~exist('meg_file', 'var')
0720 meg_file = [];
0721 end
0722
0723
0724 result_file = [proj_root, '/', result_file];
0725
0726 if ~exist(result_file, 'file'),
0727 err = true;
0728 err_msg = 'result file does not exist.';
0729 return;
0730 end;
0731 load(result_file, 'bayes_parm');
0732
0733
0734 if isempty(meg_file)
0735 meg_file = bayes_parm.megfile{1};
0736 end
0737
0738
0739 meg_file_abs = [proj_root, '/', meg_file];
0740 if ~exist(meg_file_abs, 'file')
0741 err = true;
0742 err_msg = 'megfile does not exist.';
0743 return;
0744 end
0745 [MEGinfo] = vb_load_meg_info(meg_file_abs);
0746
0747
0748 time_parm = struct;
0749 time_parm.meg_file = meg_file;
0750 time_parm.pretrigger = vb_meginfo_get_pre_trigger(MEGinfo);
0751 time_parm.sample_freq = vb_meginfo_get_sampling_frequency(MEGinfo);
0752 time_parm.Nsample = vb_meginfo_get_sample_number(MEGinfo);
0753 time_parm.twin_meg = bayes_parm.twin_meg;
0754
0755
0756
0757 function change_save_mode(H, mode)
0758
0759
0760
0761
0762
0763 switch(mode)
0764 case SAVE_MODE_SINGLE
0765 set(H.save_file_single_button, 'Value', 1);
0766 set(H.save_file_multiple_button, 'Value', 0);
0767 set(H.jact_directory_text, 'Visible', 'off');
0768 set(H.jact_directory_text2, 'Visible', 'off');
0769 set(H.jact_directory_edit, 'Visible', 'off');
0770 case SAVE_MODE_MULTIPLE
0771 set(H.save_file_single_button, 'Value', 0);
0772 set(H.save_file_multiple_button, 'Value', 1);
0773
0774 set(H.jact_directory_text, 'Visible', 'on');
0775 set(H.jact_directory_text2, 'Visible', 'on');
0776 set(H.jact_directory_edit, 'Visible', 'on');
0777 end
0778
0779
0780
0781 function update_output_filename(H)
0782
0783
0784
0785
0786 save_dir = get(H.save_directory_edit, 'String');
0787
0788 current_file_edit = get(H.current_file_edit, 'String');
0789 jact_dir_edit = get(H.jact_directory_edit, 'String');
0790
0791
0792
0793 [path_name, current_file, ext_cur] = vb_get_file_parts(current_file_edit);
0794 [path_name, jact_dir] = vb_get_file_parts(jact_dir_edit);
0795
0796 set(H.current_file_edit, 'String', [save_dir, filesep, current_file, ext_cur]);
0797
0798
0799
0800
0801 function change_trial_average(H, mode)
0802
0803
0804
0805
0806
0807 switch(mode)
0808 case ON
0809 set(H.trial_average_on_button, 'Value', 1);
0810 set(H.trial_average_off_button, 'Value', 0);
0811 case OFF
0812 set(H.trial_average_on_button, 'Value', 0);
0813 set(H.trial_average_off_button, 'Value', 1);
0814 end
0815
0816
0817
0818 function select_time_window_time_course(H, time_parm)
0819
0820
0821
0822
0823
0824
0825
0826 twin_ini = [];
0827 [twin_ini(1)] = vb_time_to_index(...
0828 str2double(get(H.time_window_from_edit, 'String')), time_parm);
0829 [twin_ini(2)] = vb_time_to_index(...
0830 str2double(get(H.time_window_to_edit, 'String')), time_parm);
0831
0832
0833
0834
0835
0836
0837 gui_cancelled = true;
0838 set(H.figure, 'HandleVisibility', 'off');
0839 try
0840 proj_root = get(H.proj_root_edit, 'String');
0841 meg_file = [proj_root, '/', time_parm.meg_file];
0842 [twin_meg, gui_cancelled] = ...
0843 job_plot_meg(meg_file, ...
0844 2, ...
0845 time_parm.twin_meg, ...
0846 twin_ini);
0847 catch
0848 [last_msg, last_id] = lasterr;
0849 errordlg(last_msg, 'error');
0850 end
0851 set(H.figure, 'HandleVisibility', 'on');
0852
0853 if ~gui_cancelled
0854 [time] = vb_index_to_time(twin_meg(1), time_parm);
0855 set(H.time_window_from_edit, 'String', sprintf('%.2f', time));
0856 [time] = vb_index_to_time(twin_meg(2), time_parm);
0857 set(H.time_window_to_edit, 'String', sprintf('%.2f', time));
0858 end
0859
0860
0861
0862 function reload_gui_area_file(H, area_file, area_key)
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872 set(H.area_file_edit, 'String', area_file);
0873
0874
0875 keys = {};
0876 proj_root = get(H.proj_root_edit, 'String');
0877 area_file = [proj_root '/' area_file];
0878
0879 if exist(area_file, 'file') ~= 2
0880 return;
0881 end
0882
0883 load(area_file, 'Area');
0884 for n = 1 : length(Area)
0885 keys{n} = Area{n}.key;
0886 end
0887
0888
0889 if exist('area_key', 'var')
0890 focus_line = strmatch(area_key, keys, 'exact');
0891 if isempty(focus_line), focus_line = 1; end;
0892 else
0893 focus_line = 1;
0894 end
0895
0896
0897 set(H.area_key_listbox, 'String', keys);
0898 set(H.area_key_listbox, 'Value', focus_line);
0899
0900
0901
0902
0903
0904
0905 function v = DEFAULT_CURRENT_FNAME
0906 v = 'current.curr.mat';
0907 function v = SAVE_MODE_SINGLE
0908 v = 1;
0909 function v = SAVE_MODE_MULTIPLE
0910 v = 2;
0911 function v = OVERLAPPED_MODE
0912 v = 1;
0913 function v = CONCATENATE_MODE
0914 v = 2;
0915 function v = APPLICATION_NAME
0916 v = 'Current estimation';