- Use global variables. Your "other" functions output to the global variables, so they can be stored.
- A more object-oriented approach, using singleton. Create a singleton outside your main function. Store all the information to the singleton, which will stay even after your main function returns.
Function outputs inside another function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dimitris K
am 3 Aug. 2021
Kommentiert: Dimitris K
am 3 Aug. 2021
Hello everyone,
I am writing a script where I call a main function to update my variables. However this function has two outputs only and inside this function i call other functions with other outputs. So the outputs of the other functions are lost from workspace when the programms finishes as they are not output of my main function...
How can i also have all these outputs remaining in my workspace so that i can use them later in my script?
0 Kommentare
Akzeptierte Antwort
Yongjian Feng
am 3 Aug. 2021
Why not extend the outputs of your main function to output those information you want?
If for some reason that you can't extend the output of your main function, there are still some options:
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!