[Top][All Lists]

[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: Joe Koski
Subject: Re: How do get a return value from a subroutine into the workspace?
Date: Wed, 05 May 2004 21:14:53 -0600
User-agent: Microsoft-Entourage/

on 5/5/04 8:38 PM, Henry F. Mollet at address@hidden 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.
> Henry
You set it up in the function call. For example, here's the first line of a

function [A,f,tt] = hhspectrum(imf,t,l,aff)

And here is the line that gets the values A,f,tt back to the calling program

[A,f,tt] = hhspectrum(imf,t,l,0);

In the calling program, you could change the names to be different from
those in the function, if desired, e. g.,

[B,g,ttt] = hhspectrum(imf2,tx,m,0);

It's the position in the list that matters, not the actual variable name.


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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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