MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE Guía de usuario Pagina 121

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 274
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 120
Mixing M-Files and C or C++
4-45
mrankp.c
The code in mrankp.c calls mrank and outputs the values that mrank returns:
/*
* MRANKP.C
* "Posix" C main program illustrating the use of the MATLAB Math
* Library.
* Calls mlfMrank, obtained by using MCC to compile mrank.m.
*
* $Revision: 1.3 $
*
*/
#include <stdio.h>
#include <math.h>
#include "matlab.h"
/* Prototype for mlfMrank */
extern mxArray *mlfMrank( mxArray * );
main( int argc, char **argv )
{
mxArray *N; /* Matrix containing n. */
mxArray *R; /* Result matrix. */
int n; /* Integer parameter from command line. */
/* Get any command line parameter. */
if (argc >= 2) {
n = atoi(argv[1]);
} else {
n = 12;
}
PkgInitialize(); /* Initialize the library of M-Functions */
/* Create a 1-by-1 matrix containing n. */
N = mlfScalar(n);
/* Call mlfMrank, the compiled version of mrank.m. */
R = mlfMrank(N);
Vista de pagina 120
1 2 ... 116 117 118 119 120 121 122 123 124 125 126 ... 273 274

Comentarios a estos manuales

Sin comentarios