⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subget.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function pstruct = subget(hnd,props)
% subget  - get a list of properties as a struct
%
% this function simplifies getting multiple properties from
% MATLAB's graphics handle objects.
%
% FORMAT:       propstruct = subget(handle, props)
%
% Input fields:
%
%       handle      Nx1 graphic handles
%       props       either a single string or a cell array or
%                   strings naming properties of the handles
%
% Output fields:
%
%       propstruct  Nx1 structure array with property contents
%
% See also get.

% Version:  v0.5c
% Build:    6120415
% Date:     Dec-04 2006, 3:15 PM CET
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% enough arguments ?
if nargin < 2
    error( ...
        'BVQXtools:TooFewArguments',...
        'Too few arguments. Try ''help %s''.',...
        mfilename ...
    );
end

if isempty(hnd) || ...
   ~all(ishandle(hnd))
    error( ...
        'BVQXtools:BadArgument',...
        'Invalid handle argument.' ...
    );
end

if ischar(props), props = {props(:)'}; end
if ~iscell(props)
    error( ...
        'BVQXtools:BadArgument',...
        'Invalid props argument.' ...
    );
end

hnd     = hnd(:);
nhnd    = size(hnd,1);
pstruct = cell2struct(cell(1,1,0),{},3);

for cc = 1:numel(props)
    try
        get(hnd(1),props{cc});
        pstruct.(props{cc}) = [];
    catch
        % nothing
    end
end

props = fieldnames(pstruct);
if isempty(props)
    error( ...
        'BVQXtools:NoValidProperty',...
        'No valid property names given.' ...
    );
end

props = props(:)';
pstruct(1) = [];

values = get(hnd,props);
for cc = 1:size(props,2)
    [pstruct(1:nhnd,1).(props{cc})] = deal(values{:,cc});
end

⌨️ 快捷键说明

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