Home > functions > job > job_plot_currentmap_dir > job_plot_cmap_setting_dlg_set_file.m

job_plot_cmap_setting_dlg_set_file

PURPOSE ^

set file to GUI.

SYNOPSIS ^

function [result] = job_plot_cmap_setting_dlg_set_file(H, file, file_type)

DESCRIPTION ^

 set file to GUI.
 [USAGE]
    [result] = job_plot_cmap_setting_dlg_set_file(H, file, file_type);
 [IN]
            H : graphics handles             <<struct>>
         file : fullpath filename.           <<string>>
    file_type : file type of specified file. <<string>>
                = 'brain_file'    : cortical model file(.brain.mat)
                = 'area_file'     : cortical area file(.area.mat)
                = 'act_file'      : cortical act file(.act.mat)
                = 'current_file'  : cortical current file(.curr.mat)
                = 'tf_file'       : time frequency file(.tf.mat)

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [result] = job_plot_cmap_setting_dlg_set_file(H, file, file_type)
0002 % set file to GUI.
0003 % [USAGE]
0004 %    [result] = job_plot_cmap_setting_dlg_set_file(H, file, file_type);
0005 % [IN]
0006 %            H : graphics handles             <<struct>>
0007 %         file : fullpath filename.           <<string>>
0008 %    file_type : file type of specified file. <<string>>
0009 %                = 'brain_file'    : cortical model file(.brain.mat)
0010 %                = 'area_file'     : cortical area file(.area.mat)
0011 %                = 'act_file'      : cortical act file(.act.mat)
0012 %                = 'current_file'  : cortical current file(.curr.mat)
0013 %                = 'tf_file'       : time frequency file(.tf.mat)
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 
0019 %
0020 % --- Previous check
0021 %
0022 if ~exist('H', 'var')
0023     error('H is a required parameter.');
0024 end
0025 if ~exist('file', 'var')
0026     error('file is a required parameter.');
0027 end
0028 if ~exist('file_type', 'var')
0029     error('file_type is a required parameter.');
0030 end
0031 
0032 %
0033 % --- Main Procedure
0034 %
0035 result = SUCCESS;
0036 
0037 ext = '';
0038 d = vb_define_extension;
0039 
0040 switch(file_type)
0041     case 'brain_file'
0042         ext = d.BRAIN_EXTENSION;
0043         comp_edit  = H.brain_file_edit;
0044         comp_check = H.brain_file_update_checkbox;
0045     case 'area_file'
0046         ext = d.AREA_EXTENSION;
0047         comp_edit = H.area_file_edit;
0048         comp_check = H.area_file_update_checkbox;
0049     case 'act_file'
0050         ext = d.FMRI_EXTENSION;
0051         comp_edit = H.act_file_edit;
0052         comp_check = H.act_file_update_checkbox;
0053     case 'current_file'
0054         ext = d.CURRENT_EXTENSION;
0055         comp_edit = H.current_file_edit;
0056         comp_check = H.current_file_update_checkbox;
0057     case 'tf_file'
0058         ext = '.tf.mat';
0059         comp_edit = H.tf_file_edit;
0060         comp_check = H.tf_file_update_checkbox;
0061     otherwise
0062         error('Specified file_type is unknown.');
0063 end
0064 
0065 %
0066 % --- File validity check
0067 %
0068 if isempty(file)
0069     file = getappdata(comp_edit, 'prev');
0070     set(comp_edit, 'String', file);
0071     return;
0072 end
0073 
0074 if exist(file, 'file') ~= 2
0075 %    set(comp_check, 'Value', 0);
0076     result = FAILURE;
0077     return;
0078 end
0079 
0080 % no filename
0081 if length(file) < length(ext)
0082     result = FAILURE;
0083     return;
0084 end
0085 
0086 % extension check
0087 if ~strcmpi(file(end-length(ext)+1:end), ext)
0088     result = FAILURE;
0089     return;
0090 end
0091 
0092 % Set filename
0093 set(comp_edit, 'String', file);
0094 % remember file as a previous collect input(currently unused information)
0095 setappdata(comp_edit, 'prev', file);
0096 % update checkbox ON
0097 set(comp_check, 'Value', 1);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005