vmp_savesubset.m

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

M
65
字号
function hfile2 = vmp_SaveSubset(hfile, sset, nfilename)
% VMP::SaveSubset  - save a subset of maps to a new file
%
% FORMAT:       [subset] = vmp.SaveSubset(sset, newfilename)
%
% Input fields:
%
%       sset        1xN list of Maps to save
%       newfilename name for new VMP file
%
% Output fields:
%
%       subset      VMP object with sub-selection

% Version:  v0.7b
% Build:    7090215
% Date:     Sep-02 2006, 3:29 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin ~= 3 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'vmp') || ...
   ~isa(sset, 'double') || ...
    isempty(sset) || ...
    any(isinf(sset(:)') | isnan(sset(:)') | fix(sset(:)') ~= sset(:)') || ...
    any(sset(:)' < 1) || ...
   ~ischar(nfilename) || ...
    isempty(nfilename)
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end
bc = bvqxfile_getcont(hfile.L);

% correctly get arguments
sset = unique(min(sset(:), bc.NrOfMaps));
if isempty(sset)
    error( ...
        'BVQXfile:BadArgument', ...
        'No maps to save remain.' ...
    );
end

% copy hfile but only wanted maps
hfile2 = BVQXfile('new:vmp');
bc2 = bvqxfile_getcont(hfile.L);
bc2.Map = bc.Map(sset(:)');
bc2.NrOfMaps = numel(bc2.Map);
bvqxfile_setcont(hfile2.L, bc2);

% try to save
try
    aft_SaveAs(hfile2, nfilename(:)');
catch
    warning( ...
        'BVQXfile:InternalError', ...
        'Error saving maps to new file: ''%s''.', ...
        lasterr ...
    );
end

⌨️ 快捷键说明

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