[go: up one dir, main page]

Menu

[0713af]: / mexsources / transf.c  Maximize  Restore  History

Download this file

62 lines (50 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "mex.h"
#include "guisdap.h"
/* Output Arguments */
#define NIN0_OUT plhs[0]
#define TIT0_OUT plhs[1]
#define MIM0_OUT plhs[2]
#define PSI_OUT plhs[3]
#define VI_OUT plhs[4]
/* Input Arguments */
#define P_IN prhs[0]
#define M_IN prhs[1]
#ifdef MAC
extern long ffloor(double x);
#endif
#ifdef ANSI_C
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
#else
mexFunction(nlhs, plhs, nrhs, prhs)
int nlhs, nrhs;
mxArray *plhs[];
const mxArray *prhs[];
#endif
{
unsigned long ns,nion;
double *pPr,*nin0Pr,*tit0Pr,*mim0Pr,*psiPr,*viPr,*p_m0;
/* First check that we get the proper number of input & output arguments */
if(nrhs!=2)
mexErrMsgTxt("Transf requires two input arguments.");
if(nlhs!=5)
mexErrMsgTxt("Transf requires five output arguments.");
/* Then get the pointers to the data part of the matrices */
ns =mxGetM(P_IN); /* Number of spectra */
pPr =mxGetPr(P_IN);
p_m0=mxGetPr(M_IN);
nion=mxGetM(M_IN)*mxGetN(M_IN);
NIN0_OUT=mxCreateDoubleMatrix(ns, nion+1, mxREAL);
TIT0_OUT=mxCreateDoubleMatrix(ns, nion+1, mxREAL);
MIM0_OUT=mxCreateDoubleMatrix(ns, nion+1, mxREAL);
PSI_OUT =mxCreateDoubleMatrix(ns, nion+1, mxREAL);
VI_OUT =mxCreateDoubleMatrix(ns, nion+1, mxREAL);
nin0Pr=mxGetPr(NIN0_OUT);
tit0Pr=mxGetPr(TIT0_OUT);
mim0Pr=mxGetPr(MIM0_OUT);
psiPr =mxGetPr(PSI_OUT);
viPr =mxGetPr(VI_OUT);
Transf(pPr,nin0Pr,tit0Pr,mim0Pr,psiPr,viPr,p_m0,nion);
}