📄 caxis.c
字号:
/*
* MATLAB Compiler: 2.0.1
* Date: Tue May 08 21:28:22 2001
* Arguments: "-B" "sgl" "-m" "-W" "mainhg" "-L" "C" "asufit.m" "absfun.m"
* "absfunfree.m" "absfunshift.m" "absfunwidth.m" "dispfit.m" "dispfitdisp.m"
* "dispfitfree.m" "dispfitwidth.m" "seqmodfree.m" "spcfun.m" "spcfun1.m"
* "atamult.m" "aprecon.m"
*/
#include "caxis.h"
/*
* The function "Mcaxis" is the implementation version of the "caxis"
* M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\caxis.m" (lines
* 1-46). 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 [cmin, cmax] = caxis(arg)
*/
static mxArray * Mcaxis(mxArray * * cmax, int nargout_, mxArray * arg) {
mxArray * cmin = mclGetUninitializedArray();
mxArray * ans = mclInitializeAns();
mxArray * ax = mclGetUninitializedArray();
mxArray * c = mclGetUninitializedArray();
mxArray * nargin_ = mclGetUninitializedArray();
mxArray * nargout = mclInitialize(mlfScalar(nargout_));
mxArray * r = mclGetUninitializedArray();
mlfAssign(&nargin_, mlfNargin(0, arg, NULL));
mclValidateInputs("caxis", 1, &arg);
/*
* %CAXIS Pseudocolor axis scaling.
* % CAXIS(V), where V is the two element vector [cmin cmax], sets manual
* % scaling of pseudocolor for the SURFACE and PATCH objects created by
* % commands like MESH, PCOLOR, and SURF. cmin and cmax are assigned
* % to the first and last colors in the current colormap. Colors for PCOLOR
* % and SURF are determined by table lookup within this range. Values
* % outside the range are clamped to the first or last colormap color.
* % CAXIS('manual') fixes axis scaling at the current range.
* % CAXIS('auto') sets axis scaling back to autoranging.
* % CAXIS, by itself, returns the two element row vector containing the
* % [cmin cmax] currently in effect.
* %
* % CAXIS is an M-file that sets the axes properties CLim and CLimMode.
* %
* % See also COLORMAP, AXES, AXIS.
*
* % Copyright (c) 1984-98 by The MathWorks, Inc.
* % $Revision: 5.5 $ $Date: 1997/11/21 23:33:37 $
*
* ax = gca;
*/
mlfAssign(&ax, mlfGca(NULL));
/*
*
* if(nargin == 0)
*/
if (mlfTobool(mlfEq(nargin_, mlfScalar(0.0)))) {
/*
* cmin = get(ax,'CLim');
*/
mlfAssign(&cmin, mlfGet(ax, mxCreateString("CLim"), NULL));
/*
* if(nargout == 2)
*/
if (mlfTobool(mlfEq(nargout, mlfScalar(2.0)))) {
/*
* cmax = cmin(2); cmin = cmin(1);
*/
mlfAssign(cmax, mlfIndexRef(cmin, "(?)", mlfScalar(2.0)));
mlfAssign(&cmin, mlfIndexRef(cmin, "(?)", mlfScalar(1.0)));
/*
* end
*/
}
/*
* else
*/
} else {
/*
* if(isstr(arg))
*/
if (mlfTobool(mlfIsstr(arg))) {
/*
* if(strcmp(arg, 'auto'))
*/
if (mlfTobool(mlfStrcmp(arg, mxCreateString("auto")))) {
/*
* set(ax,'CLimMode','auto');
*/
mclAssignAns(
&ans,
mlfNSet(
0,
ax,
mxCreateString("CLimMode"),
mxCreateString("auto"),
NULL));
/*
* elseif(strcmp(arg, 'manual'))
*/
} else if (mlfTobool(mlfStrcmp(arg, mxCreateString("manual")))) {
/*
* set(ax,'CLimMode','manual');
*/
mclAssignAns(
&ans,
mlfNSet(
0,
ax,
mxCreateString("CLimMode"),
mxCreateString("manual"),
NULL));
/*
* else
*/
} else {
/*
* error('Unknown command option')
*/
mlfError(mxCreateString("Unknown command option"));
/*
* end
*/
}
/*
* else
*/
} else {
/*
* [r c] = size(arg);
*/
mlfSize(mlfVarargout(&r, &c, NULL), arg, NULL);
/*
* if(r * c == 2)
*/
if (mlfTobool(mlfEq(mlfMtimes(r, c), mlfScalar(2.0)))) {
/*
* set(ax,'CLim',arg);
*/
mclAssignAns(
&ans, mlfNSet(0, ax, mxCreateString("CLim"), arg, NULL));
/*
* else
*/
} else {
/*
* error('Must be two element row vector.')
*/
mlfError(mxCreateString("Must be two element row vector."));
/*
* end
*/
}
/*
* end
*/
}
/*
* end
*/
}
mclValidateOutputs("caxis", 2, nargout_, &cmin, cmax);
mxDestroyArray(ans);
mxDestroyArray(ax);
mxDestroyArray(c);
mxDestroyArray(nargin_);
mxDestroyArray(nargout);
mxDestroyArray(r);
return cmin;
}
/*
* The function "mlfNCaxis" contains the nargout interface for the "caxis"
* M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\caxis.m" (lines
* 1-46). This interface is only produced if the M-function uses the special
* variable "nargout". The nargout interface allows the number of requested
* outputs to be specified via the nargout argument, as opposed to the normal
* interface which dynamically calculates the number of outputs based on the
* number of non-NULL inputs it receives. This function processes any input
* arguments and passes them to the implementation version of the function,
* appearing above.
*/
mxArray * mlfNCaxis(int nargout, mxArray * * cmax, mxArray * arg) {
mxArray * cmin = mclGetUninitializedArray();
mxArray * cmax__ = mclGetUninitializedArray();
mlfEnterNewContext(1, 1, cmax, arg);
cmin = Mcaxis(&cmax__, nargout, arg);
mlfRestorePreviousContext(1, 1, cmax, arg);
if (cmax != NULL) {
mclCopyOutputArg(cmax, cmax__);
} else {
mxDestroyArray(cmax__);
}
return mlfReturnValue(cmin);
}
/*
* The function "mlfCaxis" contains the normal interface for the "caxis"
* M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\caxis.m" (lines
* 1-46). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfCaxis(mxArray * * cmax, mxArray * arg) {
int nargout = 1;
mxArray * cmin = mclGetUninitializedArray();
mxArray * cmax__ = mclGetUninitializedArray();
mlfEnterNewContext(1, 1, cmax, arg);
if (cmax != NULL) {
++nargout;
}
cmin = Mcaxis(&cmax__, nargout, arg);
mlfRestorePreviousContext(1, 1, cmax, arg);
if (cmax != NULL) {
mclCopyOutputArg(cmax, cmax__);
} else {
mxDestroyArray(cmax__);
}
return mlfReturnValue(cmin);
}
/*
* The function "mlfVCaxis" contains the void interface for the "caxis"
* M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\caxis.m" (lines
* 1-46). The void interface is only produced if the M-function uses the
* special variable "nargout", and has at least one output. The void interface
* function specifies zero output arguments to the implementation version of
* the function, and in the event that the implementation version still returns
* an output (which, in MATLAB, would be assigned to the "ans" variable), it
* deallocates the output. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlfVCaxis(mxArray * arg) {
mxArray * cmin = mclUnassigned();
mxArray * cmax = mclUnassigned();
mlfEnterNewContext(0, 1, arg);
cmin = Mcaxis(&cmax, 0, arg);
mlfRestorePreviousContext(0, 1, arg);
mxDestroyArray(cmin);
mxDestroyArray(cmax);
}
/*
* The function "mlxCaxis" contains the feval interface for the "caxis"
* M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\caxis.m" (lines
* 1-46). The feval function calls the implementation version of caxis through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxCaxis(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[2];
int i;
if (nlhs > 2) {
mlfError(
mxCreateString(
"Run-time Error: File: caxis Line: 1 Column: 0 The function \"caxis"
"\" was called with more than the declared number of outputs (2)"));
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: caxis Line: 1 Column: 0 The function \"caxis"
"\" was called with more than the declared number of inputs (1)"));
}
for (i = 0; i < 2; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mcaxis(&mplhs[1], nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
for (i = 1; i < 2 && i < nlhs; ++i) {
plhs[i] = mplhs[i];
}
for (; i < 2; ++i) {
mxDestroyArray(mplhs[i]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -