bless.m

来自「toolbox of BVQX, This is the access betw」· M 代码 · 共 58 行

M
58
字号
function hfile = bless(hfile, lev)
% BVQXfile::bless  - make object non-unwindable
%
% FORMAT:       [obj = ] bless(obj [, lev]);
%
% Input fields:
%
%       obj         valid BVQXfile object
%       lev         optional levels, if not given up to base WS
%
% Output fields:
%
%       obj         copy of input object (for convenience)

% Version:  v0.7b
% Build:    7082921
% Date:     Aug-29 2007, 9:31 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% global storage
global bvqxclup;
global bvqxcont;

% argument check
if nargin < 1 || ...
    any(~isBVQXfile(hfile))
    return;
end
if nargin < 2 || ...
    isa(lev, 'double') || ...
    numel(lev) ~= 1 || ...
    isnan(lev) || ...
    lev < 1
    lev = Inf;
else
    lev = fix(lev);
end

% iterate over object
sfile = struct(hfile);
for sc = 1:numel(sfile)
    
    % remove stack entirely
    ifile = find(bvqxclup == sfile(sc).L);
    if isinf(lev)
        bvqxcont(ifile).U = {};
        
    % remove part of stack
    else
        U = bvqxcont(ifile).U;
        if ~isempty(U)
            U(1:min(numel(U), lev)) = [];
            bvqxcont(ifile).U = U;
        end
    end
end

⌨️ 快捷键说明

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