Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.fr>
Newsgroups: comp.soft-sys.matlab
Subject: Re: call by reference
Date: Sat, 12 Apr 2008 11:53:01 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 28
Message-ID: <ftq7qt$q7g$1@fred.mathworks.com>
References: <ftq2lv$e97$1@fred.mathworks.com> <8672860.1207996734521.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: "Bruno Luong" <b.luong@fogale.fr>
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 1208001181 26864 172.30.248.37 (12 Apr 2008 11:53:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 12 Apr 2008 11:53:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:462569



Jeroen <jverhoeve@hotmail.com> wrote in message
<8672860.1207996734521.JavaMail.jakarta@nitrogen.mathforum.org>...

> 
> 
> The package you suggest can only work with vectors and
matrices, while I want to pass my own defined data types by
reference.

MATLAB engine has a smart mechanism that avoids to duplicate
data when it is not necessary, even when passing parameter
by value. The only (?) data type that requires a large
amount of (contiguous) memory and needed to be duplicate
entirely when a element is changed is array. That's why the
inplace FEX program works on array.

You might want to pass your structure object as value, and
use inplace for subfields that are big arrays.

Otherwise you might have to program your own mex function
with (structure) parameters passing as reference.

Please see the recent thread for various opinions and
informations:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/163743

Bruno