0
votes

EDIT: Issues resolved by restarting my Matlab GUI.

I was testing my code and ran it multiple times. Without any change in the code, one time I ran it I was presented with an array of errors. Here is the error:

warning: load_path: ./lib/jsonlab: No such file or directory
warning: load_path: ./lib: No such file or directory
warning: load_path: ./lib/jsonlab: No such file or directory
warning: load_path: ./lib: No such file or directory
warning: load_path: ./lib/jsonlab: No such file or directory
warning: load_path: ./lib: No such file or directory
error: 'linearRegCostFunction' undefined near line 1 column 8

And the function declaration at line 1:

function [J, grad] = linearRegCostFunction(X, y, theta, lambda)

And, finally, the command I entered:

[J g] = linearRegCostFunction(X, y, theta, 7)

Thanks in advance for any potential help!

1

1 Answers

0
votes

Without knowing more details, I would guess that there are functions or operations within linearRegCostFunction that alter the load path (i.e. the list of directories that Octave searches for the function declaration). Most likely something is changing the current working directory (which is included as a part of the load path) where I'm guessing linearRegCostFunction is located.

Running your code the first time with the proper current directory wouldn't give you errors, but the next time you run it (with the modified current directory) you would see these sorts of problems. I'd check what your current working directory is before and after running your code the first time.