bugGNU Octave - Bugs: bug #44854, when calling a scrypt octave is...

 
 

bug #44854: when calling a scrypt octave is returning a variable value

Submitted by:  None
Submitted on:  Thu 16 Apr 2015 12:42:50 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.2
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 16 Apr 2015 01:01:47 PM UTC, comment #1:

Hi,

This is the normal behavior, not a bug.
When you execute "et" in the command window, Octave first searches for variables and then function and scripts named "et". When you first run your script, "et" is not defined as a variable so Octave runs the script "et.m". After that an "et" variable is defined and will shadow the "et.m" script itself.
Remember that scripts, unlike functions, are run in the base workspace (the one you are working in when in the command window).

The workaround is to not define a variable with the same name as the script (highly recommended) or to "clear et" before trying to run the script.

Closing the bug report.

Pantxo Diribarne <pantxo>
Project Member
Thu 16 Apr 2015 12:42:50 PM UTC, original submission:

I have created a scrypt that is called et.m
The first two lines of the scrypt are
clc
clear all
Along the scrypt, I define a variable et

When i first run the scrypt, with no variables in memory, the scrypt is running normally.
But after I ran the script once, at the second try it displays the variable et instead of running all the scrypt.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by pantxo (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 16 Apr 2015 01:01:47 PM UTCpantxoStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1