bugGNU Octave - Bugs: bug #56408, Error:invalid call to script even...

 
 

bug #56408: Error:invalid call to script even though proper syntax followed

Submitter:  None
Submitted:  Tue 28 May 2019 11:27:10 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  umar Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.1.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 29 May 2019 02:05:36 AM UTC, comment #1: 

You are seeing this error because the first non-comment word in your function file is not "function".

You need to change the first line of your function to be


function J=costfunction(x,y,theta)


John W. Eaton <jwe>
Group administrator
Tue 28 May 2019 11:27:10 PM UTC, original submission:  

I was trying to load a function saved in the same working directory of the Octave GUI. However, upon calling the script, an error message pops up.

The function, saved as costfunctionj.m, is:
J=costfunction(x,y,theta)

m=size(x,1);
predictions=x*theta;
sqrErrors=(predictions-y).^2;
J=1/(2*m)*sum(sqrErrors);

when it is called in GUI with

m=costfunctionj(x,y,theta);

the following error message shows up:

error: invalid call to script C:\Users\umara\Desktop\costfunctionj.m

I have searched for a solution everywhere but am unable to find one. It seems this was a bug encountered in previous releases as well. Please get back to me with the proper fix.

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 jwe (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-29 jwe StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code