Path: news.mathworks.com!not-for-mail
From: "Titus" <titus.edelhofer@mathworks.de>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Modifying MEX arguments in place?
Date: Thu, 14 Feb 2008 09:42:34 +0100
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <fp0utr$4gr$1@fred.mathworks.com>
References: <fp0fqv$3gd$1@fred.mathworks.com>
NNTP-Posting-Host: de-edelhoft-x.ac.mathworks.de
X-Trace: fred.mathworks.com 1202978555 4635 172.16.75.150 (14 Feb 2008 08:42:35 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 14 Feb 2008 08:42:35 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
Xref: news.mathworks.com comp.soft-sys.matlab:451329




"Petr Krysl" <pkryslNOSP@Mucsd.edu> schrieb im Newsbeitrag 
news:fp0fqv$3gd$1@fred.mathworks.com...
> For the MEX experts out there: I would like to factor a huge
> matrix (passed in as a one-dimensional array) in-place in a
> mex file.  Unfortunately, the documentation says there may
> be side effects (and there are: the Matlab executive is
> apparently getting all mixed up).
>
> Is there no way I could modify an argument in-place? If that
> is not possible, the penalty would be huge.  We are talking
> about a matrix of several gigabytes size...
>
> Thanks for your help.
>
> Petr

Hi,

besides the warnings given by others, I have another question:
do you really need to do this in a mex file? And why?
MATLAB provides some sort of in-place operation for
variables, e.g.,

function X = somefunction(X)
% modify X

and you call this function by

foo = somefunction(foo);

then MATLAB will actually not copy your matrix foo...

Titus