Effacer les filtres
Effacer les filtres

Calling the results from two scripts in one third script

1 vue (au cours des 30 derniers jours)
Sergio Manzetti
Sergio Manzetti le 31 Juil 2017
Modifié(e) : Stephen23 le 31 Juil 2017
Hello, I have two scripts which both generate a result, one script is called 1.m and the second 2.m.
Each generates the result defined by "res" in each of the scripts.
I'd like to multiply the two "res" from 1.m and 2.m in a third script, 3.m. How can I do that?
Thanks
  1 commentaire
Stephen23
Stephen23 le 31 Juil 2017
Modifié(e) : Stephen23 le 31 Juil 2017
The best and most reliable answer: write functions instead of scripts, and then simply return an output argument from each function: Simple, neat, reliable, robust, easy to debug, easy to understand, etc., etc..

Connectez-vous pour commenter.

Réponse acceptée

ES
ES le 31 Juil 2017
script3.m
script1;%Running script1.m
a = res;%storing value of res in a
script2;%Running script2.m
b = res;%storing value of res in b
c=a*b;

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB 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