Call function written in the same script using F9

7 Ansichten (letzte 30 Tage)
Alberto Mora
Alberto Mora am 5 Feb. 2020
Bearbeitet: Alberto Mora am 5 Feb. 2020
Hello,
let assume this simple code with a custom routine at the end of the code:
a = 0:0.01:100;
b = sin(0:0.01:100);
RMSE_results = Routine_RMSE(a, b);
function [RMSE]=Routine_RMSE(y, yhat)
RMSE = sqrt(mean((y - yhat).^2)); % Root Mean Squared Error
end
If I run it using the RUN button, it works properly.
If I try to run it line by line executing it using F9 the function into the code appears as "undefined", however if I define the routine into an external file, then it works. The function is working also if I execute the entire "section", but is not recognized using F9.
How can call the function written in the same code using F9 ?

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by