| MATLAB Central > MATLAB Newsreader > Q: How to pass by reference even when changing ... |
|
|
|
Subject: Q: How to pass by reference even when changing a value in a function? From: anderson@satchmo.cs.colostate.edu (Chuck Anderson) Date: 28 May, 1997 17:25:37 Message: 1 of 7 |
|
I know that matlab effectively passes by value when the value of an argument |
|
Subject: Q: How to pass by reference even when changing a value in a function? From: Steve Eddins Date: 29 May, 1997 06:45:55 Message: 2 of 7 |
|
|
|
Subject: Q: How to pass by reference even when changing a value in a function? From: Arnaud Delorme Date: 31 Mar, 2009 16:48:01 Message: 3 of 7 |
|
Yes, there is a way and it took me forever to find it. It is not elegant but it works. It consists in declaring a global variable in the scope of the caller and the called function, then erase all other variable, modify the global variable, and copy it back to the variable in the called function. |
|
Subject: Q: How to pass by reference even when changing a value in a function? From: James Tursa Date: 1 Apr, 2009 07:20:03 Message: 4 of 7 |
|
anderson@satchmo.cs.colostate.edu (Chuck Anderson) wrote in message <5mieth$ota@satchmo.cs.colostate.edu>... |
|
Subject: Q: How to pass by reference even when changing a value in a function? From: Tilman Sumpf Date: 30 Sep, 2010 09:52:04 Message: 5 of 7 |
|
ok, this is a pretty old post, but since I had a similar problem i'd like to mention the workaround to create a parameter as an instance of a handle class...: |
|
Subject: Q: How to pass by reference even when changing a value in a function? From: Joel F Date: 6 Oct, 2010 19:58:19 Message: 6 of 7 |
|
Thank you much, this works very well! I experienced a 100% speed up in my code by using this pass by reference work around. |
|
Subject: Q: How to pass by reference even when changing a value in a function? From: Matt J Date: 6 Oct, 2010 20:23:20 Message: 7 of 7 |
|
"Joel F" <jcforman@umich.edu> wrote in message <i8ikcr$3d0$1@fred.mathworks.com>... |
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
| Tag Activity for This Thread | ||
|---|---|---|
| Tag | Applied By | Date/Time |
| oop | per isakson | 2 Oct, 2010 12:40:44 |
Contact us at files@mathworks.com
