Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Callbaks, Passing by reference, setting output
Date: Fri, 14 Sep 2007 13:48:18 +0000 (UTC)
Organization: Carnegie Mellon
Lines: 33
Message-ID: <fce3f2$6al$1@fred.mathworks.com>
References: <fcdm6c$vk$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1189777698 6485 172.30.248.37 (14 Sep 2007 13:48:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Sep 2007 13:48:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688548
Xref: news.mathworks.com comp.soft-sys.matlab:428545



You have mentioned the solution yourself - 
var1 = function(var1, var2) 

Why did you not use this to return the output from your
callback ?

If you want to know more about why matlab uses call by
value, read this - 
http://www.mathworks.com/support/solutions/data/1-15SO4.html?solution=1-15SO4




"Karl Trumstedt" <karltru@gmail.com> wrote in message
<fcdm6c$vk$1@fred.mathworks.com>...
> Hi,
> 
> I have an textcontrol defining a callback {@function, var1, 
> var2}
> 
> I want to assign var1 the value of the textbox + the value 
> of var2. This is no problem, but since matlab passes by 
> value (?) the values does not change var1. How can I either 
> pass by reference or define an output with my callback?
> 
> a callback like this:
> var1 = function(var1, var2) 
> 
> /Karl
> Developer @ Lundin Mining AB 
> http://www.lundinmining.com/index.php 
> Developer @ Auktionshuset Kolonn AB http://www.kolonn.se