Undefined function 'Fun" for input argument of type 'double'?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
function z=fun(U)
z='FPAeld1';
end
i need to call the first script from this algorithm but i'm getting error "undefined function 'Fun'.." why?
0 Commenti
Risposta accettata
James Tursa
il 9 Set 2015
I see a "fun" but I don't see a "Fun" anywhere. Do you have a file Fun.m that you are trying to call? Or are you trying to call "fun"?
12 Commenti
Stephen23
il 9 Set 2015
Modificato: Stephen23
il 9 Set 2015
The answer to this is very simple: stop writing scripts and write functions instead. While scripts are great for playing around with some data and getting things going, functions offer many many advantages over scripts, including their own name spaces, algorithm abstraction, the ability to pass variables in and out, and lots of other handy stuff.
Turn your scripts into functions and pass that data as an output.
Più risposte (1)
Walter Roberson
il 9 Set 2015
At the bottom you have
function z=fun(U)
z='FPAeld1';
end
Change that to
function z = Fun(U)
z = FPAeld1(U);
end
8 Commenti
Vedere anche
Categorie
Scopri di più su Historical Contests in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!