Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: help regarding 2D matrix using c mex file
Date: Mon, 17 Aug 2009 08:18:02 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 11
Message-ID: <h6b3nq$6ft$1@fred.mathworks.com>
References: <h6b2k6$oh2$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1250497082 6653 172.30.248.35 (17 Aug 2009 08:18:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 17 Aug 2009 08:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:563876


"oruganti murthy" <omurthy@yahoo.com> wrote in message <h6b2k6$oh2$1@fred.mathworks.com>...

>    a = mxGetPr(prhs[0]);  
> ...   
> void py_dist(SAMPLE **a, int xDim, int yDim)
> ...
>             a[x][y] = sqrt((x*x)+(y*y));

I see at least one error. The "a" returned by mxGetPr is double*. It is a double simple-pointer of linear indexing and *not* 2D C-array.

Bruno