2017-08-10 6 views
0

実際には、次のコードのmxGetPr(prhs [3])[i]の値は何ですか?実際のデータの最初の要素にmxGetPrは何を返しますか?

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) 
    { 
     int *D = new int[100]; 
     // prhs[3] is a 10x10 matrix containing floating point value 

     for (int i=0; i<100; i++) 
      D[i] = mxGetPr(prhs[3])[i]; 
    } 
+0

'mxGetPr'、それが何を返すんは何ですか? – NathanOliver

+0

'std :: cout << mxGetPr(prhs [3])[i];' – user463035818

+0

'double *'にキャストされた 'void *'型を返します。 'mxIsDouble'や' mxIsClass'を使ってdouble型かクラス型かを確認する必要があります。 –

答えて

関連する問題