www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+mbccrosssectiongui/@GraphView/pGetSelection.m

    function val = pGetSelection(obj, type)
%PGETSELECTION Return pointer to selected item
%
%  VAL = PGETSELECTION(OBJ, TYPE) returns a pointer to either the selected
%  input or output item.  if TYPE is 'input' the input pointer is returned;
%  if it is 'output' then the output pointer is returned.  If there is no
%  selected graph then a null pointer is returned.

%  Copyright 2014 The MathWorks, Inc. and Ford Global Technologies, Inc.


if strcmp(type, 'input')
    if isempty(obj.DataModel) || obj.DataModel.SelectedColumn==0
        val = xregpointer;
    else
        val = obj.MessageService.TradeoffServices.pInputs(obj.DataModel.SelectedColumn);
    end
elseif strcmp(type, 'output')
    if isempty(obj.DataModel) || obj.DataModel.SelectedRow==0
        val = xregpointer;
    else
        val = obj.OutputsCache(obj.DataModel.SelectedRow);
    end
else
    error(message('mbc:cgtradeoffgui:tradeoffGraphView:InvalidArgument'));
end