mesh_check.m

来自「Matlab下的EEG处理程序库」· M 代码 · 共 51 行

M
51
字号
function [n,exists] = mesh_check(p,meshtype)

% MESH_CHECK - Check for mesh data in p struct
%
% Useage: [n,exists] = mesh_check(p,meshtype)
%
% p is the eeg_toolbox struct (see eeg_toolbox_defaults)
% and meshtype is a string argument that is compared
% with all cells of p.mesh.data.meshtype.  If it matches,
% the return value 'n' is the matching cell, ie,
% p.mesh.data.meshtype{n} and the boolean 'exists'
% variable is true. This function is called from
% mesh_open and other mesh utilities to facilitate
% efficient handling of the p.mesh.data struct.
%

% $Revision: 1.3 $ $Date: 2003/04/07 06:12:02 $

% Licence:  GNU GPL, no implied or express warranties
% History:  02/2002, Darren.Weber@flinders.edu.au
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

n = 1;          % this is the first mesh in p.mesh.data
exists = 0;

if ~isempty(p.mesh.data),
    if isfield(p.mesh.data,'meshtype'),
        
        [s1,s2] = size(p.mesh.data.meshtype);
        
        n = s2 + 1;         % return cell number to add new meshtype
        
        indices = strcmp(p.mesh.data.meshtype,meshtype);
        found = find(indices);
        if found,
            n = found(1);
            exists = 1;
        end
        
        %             for i=1:s2,
        %                 if isequal(p.mesh.data.meshtype{i},meshtype),
        %                     n = i;      % cell number of current meshtype
        %                     exists = 1;
        %                 end
        %             end
    end
end

return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?