bugGNU Octave - Bugs: bug #45132, Funktion erzeugt Fehlermeldung vom...

 
 

bug #45132: Funktion erzeugt Fehlermeldung vom Editor aus, läuft fehlerfrei im Befehlsfenster

Submitter:  None
Submitted:  Mon 18 May 2015 03:07:42 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Jörg Rauh Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 31 May 2015 04:24:21 PM UTC, comment #2: 

No response from reporter, closing as invalid. I think Andy's supposition is right.

Or if there's some way this could be better described or presented to the user so this is clearer, feel free to reopen or suggest documentation or GUI improvements.

Mike Miller <mtmiller>
Group Member
Mon 18 May 2015 04:14:11 PM UTC, comment #1: 

This sound like you've saved your code as agm.m.
If you hit the "run" button then "agm", without arguments gets executed.

Please try to save your code as myscript.m and "run" again.

Btw: Use a = zeros (1, 11), instead a=[0,0,0,0,0,0,0,0,0,0,0];
And if you want to use a and b inside your function they have to be made global.

Andreas Weber <andy1978>
Group Member
Mon 18 May 2015 03:07:42 PM UTC, original submission:  

Dear Supporter,

Thank you for the good work you are doing!
As I am trying to understand the usage of
octave, I am working through some small
subroutines first.
If started in the commands window, it'll
work like a charm.
Yet, if in the editor window, pressing save
and execute creates an error message, saying
that one of the function parameters, when stored
into another variable, is not defined.
I don't get it.
With the given error message, I don't
know what I have to do so that my routine
is accepted and executed from the editor
window.

Best regards

Jörg


# AGM Arithmetisch-Geometrisches Mittel
#
format long
a=[0,0,0,0,0,0,0,0,0,0,0];
b=[0,0,0,0,0,0,0,0,0,0,0];
function r=agm(a0,b0)
  r=0;
  a(1)=a0;
  b(1)=b0;
  for i=1:10
    a(i+1)=(a(i)+b(i))/2;
    b(i+1)=sqrt(a(i)*b(i));
  endfor
  r=(a(11))
endfunction;
#
agm(3,4);

erzeugt folgende Fehlermeldung beim Versuch,
aus dem Editor zu starten:

error: 'a0' undefined near line 3 column 8
error: called from:
error:   agm at line 3, column 7

während sie im Befehlsfenster einandfrei läuft:

>> # AGM Arithmetisch-Geometrisches Mittel
>> #
>> format long
>> a=[0,0,0,0,0,0,0,0,0,0,0];
>> b=[0,0,0,0,0,0,0,0,0,0,0];
>> function r=agm(a0,b0)
  r=0;
  a(1)=a0;
  b(1)=b0;
  for i=1:10
    a(i+1)=(a(i)+b(i))/2;
    b(i+1)=sqrt(a(i)*b(i));
  endfor
  r=(a(11))
endfunction;
>> #
>> agm(3,4);
r =  3.48202767635957


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-31 mtmiller CategoryNone GUI
        StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
        Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code