Effacer les filtres
Effacer les filtres

How to input a function into a function?

4 vues (au cours des 30 derniers jours)
Cantor Set
Cantor Set le 15 Fév 2020
Commenté : michio le 15 Fév 2020
I wrote a matlab function fun1 and fun2
and when I included them as inputs in third function fun3 that I wrote, it gives an error - not enough input arguments.

Réponses (1)

michio
michio le 15 Fév 2020
Modifié(e) : michio le 15 Fév 2020
Have you tried using funtion handles? You can use them as inputs instead of directly using function names.
  3 commentaires
Cantor Set
Cantor Set le 15 Fév 2020
II want to nest m-files functions into an m-file function and then run the it.
The idea of function handles didn't work :(
michio
michio le 15 Fév 2020
Hm, I apologize that I haven’t given you a suitable example that suita your case, but those functions (fun1-fun3 above) can be defined as separate m-files or as subfunctions, or as nested functions. There should be a way to make it work :)
Could you give me more detailed info? Such as sample code or.. anything that explains your situation.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Compiler 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