www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgcalinput/Simple_M_file.m

    function varargout = Simple_M_file(obj,opt)
%SIMPLE_M_FILE Import from simple MATLAB file.
%
%  S = SIMPLE_M_FILE(OBJ) imports from a simple MATLAB file.
%
%  [FILTER, FILTERDESC, ISFILE] = SIMPLE_M_FILE(OBJ, 'getname') returns a
%  filter to use, a description of the type that can be used in a an open
%  file dialog, and a flag that indicates whether the importer loads from
%  file or an alternative source.

%  Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc.


% Check inputs
narginchk(1,2)
if nargin == 2
    if strcmpi(opt, 'getname')
        varargout = {'*.m', 'Simple MATLAB script (*.m)', true};
        return
    else
        error(message('mbc:cgcalinput:InvalidArgument'))
    end
end

pm = [];

% Get calibration interface
if isa(obj.filename, 'calibrationdata.mbc2minterface')
    cal = obj.filename; % interface can be set via the filename property for automated testing
    ok = true;
elseif ischar(obj.filename)
    cal = calibrationdata.mbc2minterface;
    pm = cgcalgui.progressmanager('Job', 'Import Calibration Data');
    cal.ProgressManager = pm;
    cal.Filename = obj.filename;
    ok = true;
else
    [cal,ok] = cgmbc2minterface('r');
end

% Abort if failed
if ok
    varargout{1} = pGuiConvertCalData(cal, false, pm);
else
    varargout{1} = [];
end