[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Global variables with Octave
From: |
Eric Bouyoux |
Subject: |
Global variables with Octave |
Date: |
Thu, 24 Aug 2000 09:56:51 +0100 |
Hi,
I have a problem with variables in functions:
This works :
function y = toto (x)
a = 5;
b = 20;
y = a*x+b;
endfunction
for x = 0:1:20
printf("Result = %fÜn",toto(x));
endfor
This does not work :
global a = 5;
global b = 20;
function y = toto (x)
y = a*x+b;
endfunction
for x = 0:1:20
printf("Result = %fÜn",toto(x));
endfor
error: `a' undefined near line 2 column 5
error: evaluating expression near line 2, column 5
error: evaluating binary operator `*' near line 2, column 6
error: evaluating binary operator `+' near line 2, column 8
error: evaluating assignment expression near line 2, column 3
error: called from `toto'
error: evaluating argument list element number 2
Is anyone able to help me.
Regards.
Eric Bouyoux.
eric.bouyoux.vcf
Description: Card for Eric Bouyoux
- Global variables with Octave,
Eric Bouyoux <=