Is it possible to use variables stored in the workspace inside another function ?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HN
am 22 Apr. 2020
Kommentiert: Star Strider
am 23 Apr. 2020
Is it possible to use variables stored in the workspace inside another function?
3 Kommentare
Stephen23
am 22 Apr. 2020
@HN: global variables and evalin are two anti-pattern options that you should definitely avoid using, unless you really want to force yourself into writing slow, compplex, obfuscated, buggy code that is difficult to debug.
The MATLAB documentation clearly states the the best practice is to pass input/output arguments:
Akzeptierte Antwort
Star Strider
am 22 Apr. 2020
The best option is to pass them to the function as extra parameters. See: Passing Extra Parameters for an extended discussion.
6 Kommentare
Star Strider
am 23 Apr. 2020
Please see the documentation on Passing Extra Parameters that I linked to in my original post.
I have no idea what you are doing in your code (other than it appears to be a Runge-Kutta integrator).
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Variables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
