Home > other >  A question of MATLAB, the function is like this, I don't know how to input, tried a good many t
A question of MATLAB, the function is like this, I don't know how to input, tried a good many t

Time:11-02

The function [Graph, varargout]=GraphLoad (FileName, IndexFileName SkipSqueeze, varargin)
% Loads a graph from the file
%
% Receives:
% FileName - string - the file to load
% Nx2 of integers - the actual links
% IndexFileName - string - (optional) the name of the file which doesn the index, the index file must
% comply with the following format: 2 columns. For each node it 's name (string)
% and the index are provided. The Default: [].
% - structure - The structure containing The index
%. IndexNames - vector of integers - lists the node indeces
%. IndexValues - cell STR - lists the appropreate names
% - cell 2 x1 or 1 x2 - the cell containing the index, where the first cell is indeces, while the second - their names
% SkipSqueeze - Boolean - (optional) If true (~=0), the mexGraphSqueeze function is not called after the graph is the loaded. Default: 0
% varargin - FLEX IO - The input is in FlexIO format. The following parameters are allowed:
% Parameter Name | Type | Optional | Default Value | Description
% IndexFileImportHandle | function pointer | Yes | @ (IndexFileName) textread (IndexFileName, '% s' % d). | Defines how the index file is read.
%
% Returns:
% Graph - Graph Struct - the the loaded Graph
% LUT - Nx2 of integers - (optional) Look up table of the size Nx2 (N - the number of nodes in the graph) with the
% the order in which the node 's numbering was changed. Can be 2 for corresponding ordering
The % of other node parameters. See 'mexGraphSqueeze'
%

Narginchk (1, inf);
Nargoutchk (0, 2);

If ~ FIOProcessInputParameters (varargin, GetDefaultInput)
Error (' The function input is not FlexIO compatible ');
End

If to exist (' IndexFileName ', 'var')
IndexFileName=' ';
End

If to exist (' SkipSqueeze ', 'var')
SkipSqueeze=0;
End

IndexNames=[];
IndexValues=[];
If ischar (FileName)
LinksData=https://bbs.csdn.net/topics/load (FileName, '- ASCII);
Graph. The FileName=FileName;
The else
LinksData=https://bbs.csdn.net/topics/FileName;
FileName=' ';
End
If ischar (IndexFileName) && exist (IndexFileName, 'file')
Try
[IndexValues IndexNames]=textread (IndexFileName, '% d % s');
% [IndexNames IndexValues]=IndexFileImportHandle (IndexFileName);
Catch
End
Elseif isstruct (IndexFileName)
IndexNames=IndexFileName. IndexNames;
IndexValues=IndexFileName. IndexValues;
Elseif iscell (IndexFileName) && numel (IndexFileName)==2
IndexNames=IndexFileName {1};
IndexValues=IndexFileName {2};
End
If nargout <2
Graph=ObjectCreateGraph (IndexNames LinksData, mfilename, 'IndexNames',' IndexValues, IndexValues, 'SkipSqueeze, SkipSqueeze);
The else
[Graph varargout {1}]=ObjectCreateGraph (IndexNames LinksData, mfilename, 'IndexNames',' IndexValues, IndexValues, 'SkipSqueeze, SkipSqueeze);
End
Graph. The FileName=' ';
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
The function DefaultInput=GetDefaultInput
DefaultInput={};
DefaultInput=FIOAddParameter (DefaultInput, 'IndexFileImportHandle' @ (IndexFileName) textread (IndexFileName, '% s' % d));
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  • Related