help-octave
[Top][All Lists]
Advanced

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

Re: Trouble Using Functions


From: Doug Stewart
Subject: Re: Trouble Using Functions
Date: Wed, 24 Jun 2020 15:43:01 -0400



On Wed, Jun 24, 2020 at 3:28 PM Samuel Doughty <sdoughty11@gmail.com> wrote:
I've written a short script to use functions, and it does not run for me (it says the first function encountered is not defined). Any help would be appreciated. Here is my script:

% TestFile1
p=[1;2;3]
q=[3;4;7]

function [sum,diff]=s1(a,b)
  print "   Function s1 -- sum and difference"
  sum=a+b
  diff=a-b
endfunction
function sumsq=s2(a)
  print "   Function s2 -- sum of squares"
  sumsq=a'*a
endfunction




ssq=s2(q);
[add,subt]=s1(p,q);


try again with these lines moved to the end. 
Virus-free. www.avast.com



--
DASCertificate for 206392


reply via email to

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