I have error "Unrecognized function or variable 'X'" when calling computeCost(X, y, theta)
Mostra commenti meno recenti
Hello,
I have code that funtions well when I run it with the "Run button" inside my function computeCost(X, y, theta).
Unfortunately, when I type on the commande line computeCost(X, y, theta) I get the error Unrecognized function or variable 'X'
X, y and theta are well initialized within my code.
computeCost(X, y, theta)
Unrecognized function or variable 'X'.
It is the call to the function in the prompt who raise this error. This doesn't allow me to call the function with other parameters
Can you please help?
Best Regards
Younes
Risposte (2)
KSSV
il 10 Feb 2021
You are running a function, this is not the way to call a function. You need to define the variables first and then call the function.
X = yourvariale; % define your variable
x = yourvariable ; % defin your variable
theta = yourvariable ; % define your variable
computeCost(X, y, theta) ;
You need to do the above in a file/ work space where the function is present.
1 Commento
Younes IDRISSI
il 10 Feb 2021
Younes IDRISSI
il 10 Feb 2021
0 voti
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!