www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgsurfview/@movieplot/plot.m

    function plot(obj,data)
%PLOT Takes data from which a movie can be made
%
% obj.plot(data)
% 
% data is an instance of cgsurfview.svdata
%

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


obj.PlotData = data;

if isempty(data)
    obj.reset;
    return;
end

if isempty(obj.hColorMap)
    error(message('mbc:cgsurfview:movieplot:InvalidState2'));
end

cla(obj.hAxes);
obj.hSurface = [];

t = getVariableValues(obj.PlotData,3);

% Set up the slider to allow only our "t" values
if numel(t)>1
    set(obj.hSlider,'min',t(1),'max',t(end),...
        'value',t(1),'majorticks',t,'minorticks',0);
else
    set(obj.hSlider,'min',t-1,'max',t+1,...
        'value',t(1),'majorticks',[t t],'minorticks',0);
end
    
% Set up the Z-limits of the axes, which are the same in all frames
if obj.PlotOptions.common_zrange
    zlim = getSiblingDataRange(obj.PlotData);
else
    zlim = mbcmakelimits(getValues(obj.PlotData,1)); % Z-data
end
set(obj.hAxes,'ZLim',zlim);

% Set the "box" according to the plot options
set(obj.hAxes, 'Box', obj.PlotOptions.box);

% Set the X & Y limits, which are the same in all frames.  Store the 
% "vardata" structure for later
obj.vardata = cgsurfview.setup_axes(obj.hAxes,getVariables(obj.PlotData));

% To save logic in pPlotNext, work out which matrix to use as cdata and
% take a reference to it. 
hasdata = hasData(obj.PlotData);
if hasdata(2) && ~isempty(getValues(obj.PlotData,2))
    % We have a second set of data.  Use this as the surface colour.
    obj.cdata = getValues(obj.PlotData,2);
else
    % We have only one set of data.  Use it as the surface colour.
    obj.cdata = getValues(obj.PlotData,1);
end
% Also calculate the colour range, which is
% also the same in all frames.
obj.crange = mbcmakelimits(obj.cdata(:));

obj.pPlotNext;