|
Revision 1380, 0.7 kB
(checked in by smidl, 14 years ago)
|
|
MPF v C
|
| Line | |
|---|
| 1 | #include "mex.h" |
|---|
| 2 | #include "simulator.h" |
|---|
| 3 | |
|---|
| 4 | void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { |
|---|
| 5 | double usa, usb; |
|---|
| 6 | double *x_out, *y_out; |
|---|
| 7 | |
|---|
| 8 | /* Check the number of inputs and output arguments */ |
|---|
| 9 | if ( n_input==2 ) { |
|---|
| 10 | usa = *mxGetPr(input[0]); |
|---|
| 11 | usb = *mxGetPr(input[1]); |
|---|
| 12 | pmsmsim_noreg_step(usa,usb); |
|---|
| 13 | } |
|---|
| 14 | if ( n_input==1 ) { |
|---|
| 15 | double Ww = *mxGetPr(input[0]); |
|---|
| 16 | for (int i=0;i<125; i++){ |
|---|
| 17 | pmsmsim_step(Ww,0.0); |
|---|
| 18 | } |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | output[0]= mxCreateDoubleMatrix(9, 1, mxREAL); |
|---|
| 22 | x_out= mxGetPr(output[0]); |
|---|
| 23 | |
|---|
| 24 | output[1]= mxCreateDoubleMatrix(6, 1, mxREAL); |
|---|
| 25 | y_out= mxGetPr(output[1]); |
|---|
| 26 | |
|---|
| 27 | pmsmsim_fill_xy(x_out,y_out); |
|---|
| 28 | |
|---|
| 29 | } |
|---|