Execution of script as a function is not supported

1 323 vues (au cours des 30 derniers jours)
Achraf AYEB
Achraf AYEB le 21 Fév 2023
I donwloaded a function online. It works fine until the line 58 where I have "Execution of script mix_2d_lp_fonc as a function is not supported". I don't know why, I am sure I am in the correct folder (I wrote which...).
I would be gratefull for your assistance

Réponse acceptée

Stephen23 le 21 Fév 2023
The problem is that you named the script mix_2d_lp_fonc
Then when the script gets to this line:
fcn_handles = mix_2d_lp_fonc(problem(K))
it tries to call the function mix_2d_lp_fonc.... but cannot, because that is what you called your script.
Solution: Give your script another filename.

Plus de réponses (1)

Luca Ferro
Luca Ferro le 21 Fév 2023
Modifié(e) : Luca Ferro le 21 Fév 2023
there is no definition of the function mix_2d_lp_fonc(), at least not in the file you shared. It's just the name of the script itself, so you could call it but cannot pass arguments as done at that line mix_2d_lp_fonc(problem(K)).
My guess would be that the first line, so teh declaration of the function, is missing somehow


En savoir plus sur Variables dans Help Center et File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by