📄 comet3.c
字号:
/*
* MATLAB Compiler: 2.2
* Date: Tue Jun 25 10:53:59 2002
* Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
* "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
* "array_indexing:on" "-O" "optimize_conditionals:on" "-B" "sgl" "-m" "-W"
* "main" "-L" "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
* "libmwsglm.mlib" "exm110633_1"
*/
#include "comet3.h"
#include "libmatlbm.h"
#include "libmmfile.h"
static mxChar _array1_[130] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 'c', 'o', 'm', 'e', 't',
'3', ' ', 'L', 'i', 'n', 'e', ':', ' ', '1',
' ', 'C', 'o', 'l', 'u', 'm', 'n', ':', ' ',
'1', ' ', 'T', 'h', 'e', ' ', 'f', 'u', 'n',
'c', 't', 'i', 'o', 'n', ' ', '"', 'c', 'o',
'm', 'e', 't', '3', '"', ' ', 'w', 'a', 's',
' ', 'c', 'a', 'l', 'l', 'e', 'd', ' ', 'w',
'i', 't', 'h', ' ', 'm', 'o', 'r', 'e', ' ',
't', 'h', 'a', 'n', ' ', 't', 'h', 'e', ' ',
'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ',
'n', 'u', 'm', 'b', 'e', 'r', ' ', 'o', 'f',
' ', 'o', 'u', 't', 'p', 'u', 't', 's', ' ',
'(', '0', ')', '.' };
static mxArray * _mxarray0_;
static mxChar _array3_[129] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 'c', 'o', 'm', 'e', 't',
'3', ' ', 'L', 'i', 'n', 'e', ':', ' ', '1',
' ', 'C', 'o', 'l', 'u', 'm', 'n', ':', ' ',
'1', ' ', 'T', 'h', 'e', ' ', 'f', 'u', 'n',
'c', 't', 'i', 'o', 'n', ' ', '"', 'c', 'o',
'm', 'e', 't', '3', '"', ' ', 'w', 'a', 's',
' ', 'c', 'a', 'l', 'l', 'e', 'd', ' ', 'w',
'i', 't', 'h', ' ', 'm', 'o', 'r', 'e', ' ',
't', 'h', 'a', 'n', ' ', 't', 'h', 'e', ' ',
'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ',
'n', 'u', 'm', 'b', 'e', 'r', ' ', 'o', 'f',
' ', 'i', 'n', 'p', 'u', 't', 's', ' ', '(',
'4', ')', '.' };
static mxArray * _mxarray2_;
static mxChar _array5_[27] = { 'N', 'o', 't', ' ', 'e', 'n', 'o', 'u', 'g',
'h', ' ', 'i', 'n', 'p', 'u', 't', ' ', 'a',
'r', 'g', 'u', 'm', 'e', 'n', 't', 's', '.' };
static mxArray * _mxarray4_;
static mxArray * _mxarray6_;
static mxArray * _mxarray7_;
static mxChar _array9_[10] = { 'c', 'o', 'l', 'o', 'r',
'o', 'r', 'd', 'e', 'r' };
static mxArray * _mxarray8_;
static mxArray * _mxarray10_;
static mxChar _array12_[5] = { 'c', 'o', 'l', 'o', 'r' };
static mxArray * _mxarray11_;
static mxChar _array14_[6] = { 'm', 'a', 'r', 'k', 'e', 'r' };
static mxArray * _mxarray13_;
static mxChar _array16_[1] = { 'o' };
static mxArray * _mxarray15_;
static mxChar _array18_[5] = { 'e', 'r', 'a', 's', 'e' };
static mxArray * _mxarray17_;
static mxChar _array20_[3] = { 'x', 'o', 'r' };
static mxArray * _mxarray19_;
static mxChar _array22_[5] = { 'x', 'd', 'a', 't', 'a' };
static mxArray * _mxarray21_;
static mxChar _array24_[5] = { 'y', 'd', 'a', 't', 'a' };
static mxArray * _mxarray23_;
static mxChar _array26_[5] = { 'z', 'd', 'a', 't', 'a' };
static mxArray * _mxarray25_;
static mxArray * _mxarray27_;
static mxChar _array29_[9] = { 'l', 'i', 'n', 'e', 's', 't', 'y', 'l', 'e' };
static mxArray * _mxarray28_;
static mxChar _array31_[1] = { '-' };
static mxArray * _mxarray30_;
static mxChar _array33_[4] = { 'n', 'o', 'n', 'e' };
static mxArray * _mxarray32_;
static mxArray * _mxarray34_;
static mxChar _array36_[2] = { '-', '-' };
static mxArray * _mxarray35_;
void InitializeModule_comet3(void) {
_mxarray0_ = mclInitializeString(130, _array1_);
_mxarray2_ = mclInitializeString(129, _array3_);
_mxarray4_ = mclInitializeString(27, _array5_);
_mxarray6_ = mclInitializeDouble(1.0);
_mxarray7_ = mclInitializeDouble(.1);
_mxarray8_ = mclInitializeString(10, _array9_);
_mxarray10_ = mclInitializeDouble(3.0);
_mxarray11_ = mclInitializeString(5, _array12_);
_mxarray13_ = mclInitializeString(6, _array14_);
_mxarray15_ = mclInitializeString(1, _array16_);
_mxarray17_ = mclInitializeString(5, _array18_);
_mxarray19_ = mclInitializeString(3, _array20_);
_mxarray21_ = mclInitializeString(5, _array22_);
_mxarray23_ = mclInitializeString(5, _array24_);
_mxarray25_ = mclInitializeString(5, _array26_);
_mxarray27_ = mclInitializeDouble(2.0);
_mxarray28_ = mclInitializeString(9, _array29_);
_mxarray30_ = mclInitializeString(1, _array31_);
_mxarray32_ = mclInitializeString(4, _array33_);
_mxarray34_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
_mxarray35_ = mclInitializeString(2, _array36_);
}
void TerminateModule_comet3(void) {
mxDestroyArray(_mxarray35_);
mxDestroyArray(_mxarray34_);
mxDestroyArray(_mxarray32_);
mxDestroyArray(_mxarray30_);
mxDestroyArray(_mxarray28_);
mxDestroyArray(_mxarray27_);
mxDestroyArray(_mxarray25_);
mxDestroyArray(_mxarray23_);
mxDestroyArray(_mxarray21_);
mxDestroyArray(_mxarray19_);
mxDestroyArray(_mxarray17_);
mxDestroyArray(_mxarray15_);
mxDestroyArray(_mxarray13_);
mxDestroyArray(_mxarray11_);
mxDestroyArray(_mxarray10_);
mxDestroyArray(_mxarray8_);
mxDestroyArray(_mxarray7_);
mxDestroyArray(_mxarray6_);
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray0_);
}
static void Mcomet3(mxArray * x, mxArray * y, mxArray * z, mxArray * p);
_mexLocalFunctionTable _local_function_table_comet3
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfComet3" contains the normal interface for the "comet3"
* M-function from file "d:\MATLAB6p1\toolbox\matlab\specgraph\comet3.m" (lines
* 1-77). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlfComet3(mxArray * x, mxArray * y, mxArray * z, mxArray * p) {
mlfEnterNewContext(0, 4, x, y, z, p);
Mcomet3(x, y, z, p);
mlfRestorePreviousContext(0, 4, x, y, z, p);
}
/*
* The function "mlxComet3" contains the feval interface for the "comet3"
* M-function from file "d:\MATLAB6p1\toolbox\matlab\specgraph\comet3.m" (lines
* 1-77). The feval function calls the implementation version of comet3 through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxComet3(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[4];
int i;
if (nlhs > 0) {
mlfError(_mxarray0_);
}
if (nrhs > 4) {
mlfError(_mxarray2_);
}
for (i = 0; i < 4 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 4; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 4, mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
Mcomet3(mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
mlfRestorePreviousContext(0, 4, mprhs[0], mprhs[1], mprhs[2], mprhs[3]);
}
/*
* The function "Mcomet3" is the implementation version of the "comet3"
* M-function from file "d:\MATLAB6p1\toolbox\matlab\specgraph\comet3.m" (lines
* 1-77). 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 comet3(x,y,z,p)
*/
static void Mcomet3(mxArray * x, mxArray * y, mxArray * z, mxArray * p) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_comet3);
int nargin_ = mclNargin(4, x, y, z, p, NULL);
mxArray * j = mclGetUninitializedArray();
mxArray * i = mclGetUninitializedArray();
mxArray * k = mclGetUninitializedArray();
mxArray * m = mclGetUninitializedArray();
mxArray * tail = mclGetUninitializedArray();
mxArray * body = mclGetUninitializedArray();
mxArray * head = mclGetUninitializedArray();
mxArray * co = mclGetUninitializedArray();
mxArray * ax = mclGetUninitializedArray();
mxArray * ans = mclGetUninitializedArray();
mclCopyArray(&x);
mclCopyArray(&y);
mclCopyArray(&z);
mclCopyArray(&p);
/*
* %COMET3 3-D Comet-like trajectories.
* % COMET3(Z) displays an animated three dimensional plot of the vector Z.
* % COMET3(X,Y,Z) displays an animated comet plot of the curve through the
* % points [X(i),Y(i),Z(i)].
* % COMET3(X,Y,Z,p) uses a comet of length p*length(Z). Default is p = 0.1.
* %
* % Example:
* % t = -pi:pi/500:pi;
* % comet3(sin(5*t),cos(3*t),t)
* %
* % See also COMET.
*
* % Charles R. Denham, MathWorks, 1989.
* % Revised 2-9-92, LS and DTP; 8-18-92, 11-30-92 CBM.
* % Copyright 1984-2001 The MathWorks, Inc.
* % $Revision: 5.10 $ $Date: 2001/04/15 12:03:49 $
*
* if nargin == 0, error('Not enough input arguments.'); end
*/
if (nargin_ == 0) {
mlfError(_mxarray4_);
}
/*
*
* if nargin < 3, z = x; x = 1:length(z); y = 1:length(z); end
*/
if (nargin_ < 3) {
mlfAssign(&z, mclVsa(x, "x"));
mlfAssign(
&x,
mlfColon(_mxarray6_, mlfScalar(mclLengthInt(mclVa(z, "z"))), NULL));
mlfAssign(
&y,
mlfColon(_mxarray6_, mlfScalar(mclLengthInt(mclVa(z, "z"))), NULL));
}
/*
* if nargin < 4, p = 0.10; end
*/
if (nargin_ < 4) {
mlfAssign(&p, _mxarray7_);
}
/*
*
* ax = newplot;
*/
mlfAssign(&ax, mlfNNewplot(1, NULL));
/*
* if ~ishold,
*/
if (mclNotBool(mclVe(mlfIshold(NULL)))) {
/*
* axis([min(x(isfinite(x))) max(x(isfinite(x))) min(y(isfinite(y))) ...
*/
mclPrintAns(
&ans,
mlfAxis(
NULL,
NULL,
mlfHorzcat(
mclVe(
mlfMin(
NULL,
mclVe(
mclArrayRef1(mclVsa(x, "x"), mlfIsfinite(mclVa(x, "x")))),
NULL,
NULL)),
mclVe(
mlfMax(
NULL,
mclVe(
mclArrayRef1(mclVsa(x, "x"), mlfIsfinite(mclVa(x, "x")))),
NULL,
NULL)),
mclVe(
mlfMin(
NULL,
mclVe(
mclArrayRef1(mclVsa(y, "y"), mlfIsfinite(mclVa(y, "y")))),
NULL,
NULL)),
mclVe(
mlfMax(
NULL,
mclVe(
mclArrayRef1(mclVsa(y, "y"), mlfIsfinite(mclVa(y, "y")))),
NULL,
NULL)),
mclVe(
mlfMin(
NULL,
mclVe(
mclArrayRef1(mclVsa(z, "z"), mlfIsfinite(mclVa(z, "z")))),
NULL,
NULL)),
mclVe(
mlfMax(
NULL,
mclVe(
mclArrayRef1(mclVsa(z, "z"), mlfIsfinite(mclVa(z, "z")))),
NULL,
NULL)),
NULL),
NULL));
/*
* max(y(isfinite(y))) min(z(isfinite(z))) max(z(isfinite(z)))])
* end
*/
}
/*
*
* co = get(ax,'colororder');
*/
mlfAssign(&co, mlfNGet(1, mclVv(ax, "ax"), _mxarray8_, NULL));
/*
*
* if size(co,1)>=3,
*/
if (mclGeBool(
mclVe(mlfSize(mclValueVarargout(), mclVv(co, "co"), _mxarray6_)),
_mxarray10_)) {
/*
* % Choose first three colors for head, body, and tail
* head = line('color',co(1,:),'marker','o','erase','xor', ...
*/
mlfAssign(
&head,
mlfNLine(
1,
_mxarray11_,
mclVe(
mclArrayRef2(
mclVsv(co, "co"), _mxarray6_, mlfCreateColonIndex())),
_mxarray13_,
_mxarray15_,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -