help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do get a return value from a subroutine into the workspace?


From: Paul Kienzle
Subject: Re: How do get a return value from a subroutine into the workspace?
Date: Thu, 6 May 2004 00:23:43 -0400


On May 5, 2004, at 10:38 PM, Henry F. Mollet wrote:

I'm running a main program (function) with a call to a subprogram (another function) that I have modified (removing ";" after the call) so that the return value ,a matrix called "A", will get printed to the screen. How do I get "A" into the workspace? I have to copy/paste "A" into an editor, save it as "A", then load "A" into the workspace but there must be an easier/better way to accomplish this? The return values of the main program are in the workspace after running the program and they are also printed to the screen
if I remove the ";" after the call at the octave prompt.

octave:1> function f, assignin('base','t',15); end
octave:2> f
octave:3> t
t = 15
octave:4> OCTAVE_VERSION
OCTAVE_VERSION = 2.1.55


For older versions of octave, you could also use global
variables, but be sure to declare them global in both
the workspace and in the function.

Paul Kienzle
address@hidden



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]