aft_reloadfromdisk.m

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

M
64
字号
function hfile = aft_ReloadFromDisk(hfile)
% AFT::ReloadFromDisk  - try reloading the object from disk
%
% FORMAT:       obj.ReloadFromDisk;
%
% No input / output fields.
%
% Note: if the object requires large amount of memory, this method
%       is bound to fail!

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

% global config
global bvqxfile_config;

% only valid for single file
if nargin ~= 1 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, true)
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end

% get object's super-struct
sc = bvqxfile_getscont(hfile.L);
if isempty(sc.F) || ...
   ~isabsolute(sc.F) || ...
    exist(sc.F, 'file') ~= 2
    error( ...
        'BVQXfile:BadFileName', ...
        'Cannot reload from disk, invalid file: ''%s''.', ...
        sc.F ...
    );
end

% try to load file
rs = bvqxfile_config.reloadsame;
try
    bvqxfile_config.reloadsame = true;
    nobj = BVQXfile(sc.F);
    if ~isBVQXfile(nobj, sc.S.Extensions{1})
        error('LOAD_ERROR');
    end
    bvqxfile_config.reloadsame = rs;
catch
    bvqxfile_config.reloadsame = rs;
    error( ...
        'BVQXfile:InternalError', ...
        'Error re-loading object from file: ''%s''.', ...
        sc.F ...
    );
end

% copy contents from reloaded object to old object
bvqxfile_setcont(hfile.L, bvqxfile_getcont(nobj.L));
bvqxfile_clear(nobj.L);

⌨️ 快捷键说明

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