Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Return empty sparse from a mex file
Date: Mon, 26 Oct 2009 11:50:18 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 12
Message-ID: <hc42dq$ke8$1@fred.mathworks.com>
References: <hc3s2q$fbd$1@fred.mathworks.com> <hc3uqt$dq$1@fred.mathworks.com> <hc40j6$o3d$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256557818 20936 172.30.248.37 (26 Oct 2009 11:50:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 26 Oct 2009 11:50:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:580051


Actually I just check, it seems nzmax is never set to 0 by Matlab

>> s=sparse([],[],[],1,1,0)
>> nzmax(s)

ans =

     1

So I would Realloc Pr and Ir with *1* element, set nzmax to 1, and fill Jc with zeros (as you did).

Bruno