⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plotperf.c

📁 nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的一组神经网络算法函数库
💻 C
📖 第 1 页 / 共 4 页
字号:
            _mxarray63_,
            NULL));
    /*
     * end
     */
    }
    /*
     * 
     * % Update axis x-label
     * if epoch == 0
     */
    if (mclEqBool(mclVa(epoch, "epoch"), _mxarray10_)) {
        /*
         * set(ud.TrainXlabel,'string','Zero Epochs');
         */
        mclAssignAns(
          &ans,
          mlfNSet(
            0,
            mlfIndexRef(mclVv(ud, "ud"), ".TrainXlabel"),
            _mxarray55_,
            _mxarray65_,
            NULL));
    /*
     * elseif epoch == 1
     */
    } else if (mclEqBool(mclVa(epoch, "epoch"), _mxarray6_)) {
        /*
         * set(ud.TrainXlabel,'string','One Epoch');
         */
        mclAssignAns(
          &ans,
          mlfNSet(
            0,
            mlfIndexRef(mclVv(ud, "ud"), ".TrainXlabel"),
            _mxarray55_,
            _mxarray67_,
            NULL));
    /*
     * else
     */
    } else {
        /*
         * set(ud.TrainXlabel,'string',[num2str(epoch) ' Epochs']);
         */
        mclAssignAns(
          &ans,
          mlfNSet(
            0,
            mlfIndexRef(mclVv(ud, "ud"), ".TrainXlabel"),
            _mxarray55_,
            mlfHorzcat(
              mlfNum2str(mclVa(epoch, "epoch"), NULL), _mxarray69_, NULL),
            NULL));
    /*
     * end
     */
    }
    /*
     * 
     * % Update axis y-lable
     * ystring = 'Training-Blue';
     */
    mlfAssign(&ystring, _mxarray71_);
    /*
     * if (plotGoal), ystring = [ystring '  Goal-Black']; end
     */
    if (mlfTobool(mclVv(plotGoal, "plotGoal"))) {
        mlfAssign(
          &ystring, mlfHorzcat(mclVv(ystring, "ystring"), _mxarray73_, NULL));
    }
    /*
     * if (plotValidation), ystring = [ystring '  Validation-Green']; end
     */
    if (mlfTobool(mclVv(plotValidation, "plotValidation"))) {
        mlfAssign(
          &ystring, mlfHorzcat(mclVv(ystring, "ystring"), _mxarray75_, NULL));
    }
    /*
     * if (plotTest), ystring = [ystring '  Test-Red']; end
     */
    if (mlfTobool(mclVv(plotTest, "plotTest"))) {
        mlfAssign(
          &ystring, mlfHorzcat(mclVv(ystring, "ystring"), _mxarray77_, NULL));
    }
    /*
     * set(ud.TrainYlabel,'string',ystring);
     */
    mclAssignAns(
      &ans,
      mlfNSet(
        0,
        mlfIndexRef(mclVv(ud, "ud"), ".TrainYlabel"),
        _mxarray55_,
        mclVv(ystring, "ystring"),
        NULL));
    /*
     * 
     * % FINISH
     * % ======
     * 
     * % Make changes now
     * drawnow;
     */
    mlfDrawnow(NULL);
    /*
     * 
     * % Return stop flag if required
     * if (nargout), stop = ud.stop; end
     */
    if (nargout_ != 0) {
        mlfAssign(&stop, mlfIndexRef(mclVv(ud, "ud"), ".stop"));
    }
    /*
     * 
     * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     * % Find pre-existing figure, if any
     */
    return_:
    mclValidateOutput(stop, 1, nargout_, "stop", "plotperf");
    mxDestroyArray(ans);
    mxDestroyArray(fig);
    mxDestroyArray(ud);
    mxDestroyArray(fig2);
    mxDestroyArray(ind);
    mxDestroyArray(ymax);
    mxDestroyArray(ymin);
    mxDestroyArray(plotValidation);
    mxDestroyArray(plotTest);
    mxDestroyArray(plotGoal);
    mxDestroyArray(yscale);
    mxDestroyArray(tstring);
    mxDestroyArray(ystring);
    mxDestroyArray(epoch);
    mxDestroyArray(name);
    mxDestroyArray(goal);
    mxDestroyArray(tr);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return stop;
}

/*
 * The function "Mplotperf_find_existing_figure" is the implementation version
 * of the "plotperf/find_existing_figure" M-function from file
 * "d:\matlab6p5\toolbox\nnet\nnet\plotperf.m" (lines 207-232). It contains the
 * actual compiled code for that M-function. It is a static function and must
 * only be called from one of the interface functions, appearing below.
 */
/*
 * function fig = find_existing_figure
 */
static mxArray * Mplotperf_find_existing_figure(int nargout_) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_plotperf);
    mxArray * fig = NULL;
    mxArray * child = NULL;
    /*
     * 
     * % Initially assume figure does not exist
     * fig = 0;
     */
    mlfAssign(&fig, _mxarray10_);
    /*
     * 
     * % Search children of root...
     * for child=get(0,'children')'
     */
    {
        mclForLoopIterator viter__;
        for (mclForStart(
               &viter__,
               mlfCtranspose(mlfNGet(1, _mxarray10_, _mxarray79_, NULL)),
               NULL,
               NULL);
             mclForNext(&viter__, &child);
             ) {
            /*
             * % ...for objects whose type is figure...
             * if strcmp(get(child,'type'),'figure') 
             */
            if (mlfTobool(
                  mlfStrcmp(
                    mlfNGet(1, mclVv(child, "child"), _mxarray81_, NULL),
                    _mxarray83_))) {
                /*
                 * % ...whose tag is 'train'
                 * if strcmp(get(child,'tag'),'train')
                 */
                if (mlfTobool(
                      mlfStrcmp(
                        mlfNGet(1, mclVv(child, "child"), _mxarray85_, NULL),
                        _mxarray87_))) {
                    /*
                     * % ...and stop search if found.
                     * fig = child;
                     */
                    mlfAssign(&fig, mclVv(child, "child"));
                    /*
                     * break
                     */
                    break;
                /*
                 * end
                 */
                }
            /*
             * end
             */
            }
        /*
         * end
         */
        }
        mclDestroyForLoopIterator(viter__);
    }
    /*
     * 
     * % Not sure if/why this is necessary
     * if length(get(fig,'children')) == 0
     */
    if (mclLengthInt(mlfNGet(1, mclVv(fig, "fig"), _mxarray79_, NULL)) == 0) {
        /*
         * fig = 0;
         */
        mlfAssign(&fig, _mxarray10_);
    /*
     * end
     */
    }
    mclValidateOutput(fig, 1, nargout_, "fig", "plotperf/find_existing_figure");
    mxDestroyArray(child);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return fig;
    /*
     * 
     * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     * % New figure
     */
}

/*
 * The function "Mplotperf_new_figure" is the implementation version of the
 * "plotperf/new_figure" M-function from file
 * "d:\matlab6p5\toolbox\nnet\nnet\plotperf.m" (lines 232-244). It contains the
 * actual compiled code for that M-function. It is a static function and must
 * only be called from one of the interface functions, appearing below.
 */
/*
 * function fig = new_figure(name)
 */
static mxArray * Mplotperf_new_figure(int nargout_, mxArray * name) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_plotperf);
    mxArray * fig = NULL;
    mclCopyArray(&name);
    /*
     * 
     * fig = figure(...
     */
    mlfAssign(
      &fig,
      mlfNFigure(
        1,
        _mxarray89_,
        _mxarray91_,
        _mxarray93_,
        mclVa(name, "name"),
        _mxarray95_,
        _mxarray87_,
        _mxarray97_,
        _mxarray63_,
        _mxarray99_,
        _mxarray63_,
        _mxarray101_,
        _mxarray103_,
        NULL));
    mclValidateOutput(fig, 1, nargout_, "fig", "plotperf/new_figure");
    mxDestroyArray(name);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return fig;
    /*
     * 'Units',          'pixel',...
     * 'Name',           name,...
     * 'Tag',            'train',...
     * 'NumberTitle',    'off',...
     * 'IntegerHandle',  'off',...
     * 'Toolbar',        'none');
     * 
     * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     * % Create new plot in figure
     */
}

/*
 * The function "Mplotperf_createNewPlot" is the implementation version of the
 * "plotperf/createNewPlot" M-function from file
 * "d:\matlab6p5\toolbox\nnet\nnet\plotperf.m" (lines 244-276). It contains the
 * actual compiled code for that M-function. It is a static function and must
 * only be called from one of the interface functions, appearing below.
 */
/*
 * function createNewPlot(fig)
 */
static void Mplotperf_createNewPlot(mxArray * fig) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_plotperf);
    mxArray * ud = NULL;
    mxArray * ans = NULL;
    mxArray * i = NULL;
    mxArray * z = NULL;
    mclCopyArray(&fig);
    /*
     * 
     * % Delete all children from figure
     * z = get(fig,'children');
     */
    mlfAssign(&z, mlfNGet(1, mclVa(fig, "fig"), _mxarray79_, NULL));
    /*
     * for i=1:length(z)
     */
    {
        int v_ = mclForIntStart(1);
        int e_ = mclLengthInt(mclVv(z, "z"));
        if (v_ > e_) {
            mlfAssign(&i, _mxarray105_);
        } else {
            /*
             * delete (z(i));
             * end
             */
            for (; ; ) {
                mlfDelete(mclIntArrayRef1(mclVv(z, "z"), v_), NULL);
                if (v_ == e_) {
                    break;
                }
                ++v_;
            }
            mlfAssign(&i, mlfScalar(v_));
        }
    }
    /*
     * 
     * % Create axis
     * ud.TrainAxes     = axes('Parent',fig);
     */
    mlfIndexAssign(
      &ud, ".TrainAxes", mlfNAxes(1, _mxarray106_, mclVa(fig, "fig"), NULL));
    /*
     * ud.TrainLine     = plot(0,0,0,0,0,0,0,0,'EraseMode','None','Parent',ud.TrainAxes);
     */
    mlfIndexAssign(
      &ud,
      ".TrainLine",
      mlfNPlot(
        1,
        _mxarray10_,
        _mxarray10_,
        _mxarray10_,
        _mxarray10_,
        _mxarray10_,
        _mxarray10_,
        _mxarray10_,
        _mxarray10_,
        _mxarray108_,
        _mxarray110_,
        _mxarray106_,
        mlfIndexRef(mclVv(ud, "ud"), ".TrainAxes"),
        NULL));
    /*
     * ud.TrainXlabel   = xlabel('X Axis','Parent',ud.TrainAxes);
     */
    mlfIndexAssign(
      &ud,
      ".TrainXlabel",
      mlfNXlabel(
        1,
        _mxarray112_,
        _mxarray106_, mlfIndexRef(mclVv(ud, "ud"), ".TrainAxes"), NULL));
    /*
     * ud.TrainYlabel   = ylabel('Y Axis','Parent',ud.TrainAxes);
     */
    mlfIndexAssign(
      &ud,
      ".TrainYlabel",
      mlfNYlabel(
        1,
        _mxarray114_,
        _mxarray106_, mlfIndexRef(mclVv(ud, "ud"), ".TrainAxes"), NULL));
    /*
     * ud.TrainTitle    = get(ud.TrainAxes,'Title');
     */
    mlfIndexAssign(
      &ud,
      ".TrainTitle",
      mlfNGet(
        1, mlfIndexRef(mclVv(ud, "ud"), ".TrainAxes"), _mxarray116_, NULL));
    /*
     * set(ud.TrainAxes,'yscale','log');
     */
    mclAssignAns(
      &ans,
      mlfNSet(
        0,
        mlfIndexRef(mclVv(ud, "ud"), ".TrainAxes"),
        _mxarray47_,
        _mxarray38_,
        NULL));
    /*
     * ud.XData      = [];
     */
    mlfIndexAssign(&ud, ".XData", _mxarray105_);
    /*
     * ud.YData      = [];
     */
    mlfIndexAssign(&ud, ".YData", _mxarray105_);
    /*
     * ud.Y2Data     = [];
     */
    mlfIndexAssign(&ud, ".Y2Data", _mxarray105_);
    /*
     * ud.stop_but = uicontrol('Parent',fig, ...
     */
    mlfIndexAssign(
      &ud,
      ".stop_but",
      mlfNUicontrol(
        1,
        _mxarray106_,
        mclVa(fig, "fig"),
        _mxarray89_,
        _mxarray118_,
        _mxarray120_,
        _mxarray122_,
        _mxarray124_,
        _mxarray126_,
        _mxarray128_,
        _mxarray10_,
        _mxarray130_,
        _mxarray132_,
        _mxarray134_,
        _mxarray136_,
        _mxarray95_,
        _mxarray138_,
        NULL));
    /*
     * 'Units','points', ...
     * 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
     * 'Callback',['plotperf(''stop'');'], ...
     * 'ListboxTop',0, ...
     * 'Position',[2 2 68.75 15], ...
     * 'String','Stop Training', ...
     * 'Tag','Pushbutton1');
     * ud.stop=0;
     */
    mlfIndexAssign(&ud, ".stop", _mxarray10_);
    /*
     * set(fig,'UserData',ud);
     */
    mclAssignAns(
      &ans, mlfNSet(0, mclVa(fig, "fig"), _mxarray4_, mclVv(ud, "ud"), NULL));
    /*
     * 
     * % Bring figure to front
     * figure(fig);
     */
    mclAssignAns(&ans, mlfNFigure(0, mclVa(fig, "fig"), NULL));
    mxDestroyArray(z);
    mxDestroyArray(i);
    mxDestroyArray(ans);
    mxDestroyArray(ud);
    mxDestroyArray(fig);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    /*
     * 
     */
}

⌨️ 快捷键说明

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