SM_ADC  1.0
Приём данных АЦП через разделяемую память
mex_array_product.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 /* This file illustrates how to construct a simple C++ MEX-File with
3  * easyLink.
4  *
5  * Multiplies an input scalar times a 1xN matrix and outputs a 1xN matrix
6  *
7  * The calling syntax is:
8  *
9  * outMatrix = mex_array_product(multiplier, inMatrix)
10  *
11  * To compile this C++ MEX-File, enter the following command in MATLAB:
12  *
13  * >>make mex_array_product.cpp
14  *
15  */
16 //------------------------------------------------------------------------------
17 
18 //------------------------------------------------------------------------------
19 // Specify the number and the sizes of the input ports of the function
20 //
21 // The possible types of the inputs are:
22 // * 1 for real parameters (scalar or array, use -1 as size to specify
23 // a dynamically dimensioned array)
24 // * 2 for literal string parameters
25 // * 3 for literal identifiers of MATLAB variables
26 //------------------------------------------------------------------------------
27 #define INPUT_PORT_NUMBER 2
32 
33 //------------------------------------------------------------------------------
34 // Specify the number and the sizes of the output ports of the function
35 //
36 // Use -1 to specify a dynamically dimensioned output signal
37 //------------------------------------------------------------------------------
38 #define OUTPUT_PORT_NUMBER 1
42 
43 //------------------------------------------------------------------------------
44 #include "easylink.h"
45 
46 class Function : public BaseFunction
47 {
48 private:
49 
50 public:
51 
52  static void outputs()
53  {
55  double multiplier=getInputDouble(MULTIPLIER);
56  Array matrix=getInputArray(MATRIX);
57  Array result=getOutputArray(RESULT);
58 
59  result=matrix*multiplier;
60  }
61 
62 };
63 
64 //------------------------------------------------------------------------------
65 #include "mexdefinitions.h"
66 
67 //------------------------------------------------------------------------------
Definition: array.h:29
int outputPortRows[OUTPUT_PORT_NUMBER]
outputPortName
Definition: baseblock.h:28
static int getInputNCols(int port)
Definition: basefunction.h:188
int inputPortRows[INPUT_PORT_NUMBER]
static double getInputDouble(int port)
Definition: basefunction.h:136
static Array getInputArray(int port)
Definition: basefunction.h:152
int inputPortType[INPUT_PORT_NUMBER]
static void outputs()
inputPortName
Definition: baseblock.h:20
static Array getOutputArray(int port)
Definition: basefunction.h:220
int inputPortCols[INPUT_PORT_NUMBER]
#define OUTPUT_PORT_NUMBER
int outputPortCols[OUTPUT_PORT_NUMBER]
#define INPUT_PORT_NUMBER
static void setOutputPortDimensions(int port, int nrows, int ncols)
Definition: basefunction.h:255