graphgetgraphvariables.m

来自「复杂网络的一些节点面对攻击的代码」· M 代码 · 共 35 行

M
35
字号
function GraphVariables = GraphGetGraphVariables()
% Returns a list of all variables in base workspace, which are of the type 'Graph'
%
% Receives:
%   none
%
% Returns:
%   
%
% See Also:
%   GraphLoad, GraphGIUBrowseGraph, GraphGIUSelectGraph
%
% Example:
%   Graph = ObjectCreateDataSeries(Data);
%   
% Created:
%   
%   Lev Muchnik    28/07/2005, lev@topspin.co.il, +972-54-4326496
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

error(nargchk(0,0,nargin));
error(nargoutchk(0,1,nargout));

Variables = evalin('base','who');
SelectedIndeces = [];
for i = 1 : numel(Variables)
    if ObjectIsType(evalin('base',Variables{i}),'Graph')
        SelectedIndeces(end+1) = i;
    end   
end
GraphVariables = cell(numel(SelectedIndeces) ,1);
for i = 1 : numel(SelectedIndeces) 
    GraphVariables{i} = Variables{SelectedIndeces(i)};
end

⌨️ 快捷键说明

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