Azzera filtri
Azzera filtri

Call function written in the same script using F9

4 visualizzazioni (ultimi 30 giorni)
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 ?

Risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by