How to copy only the output of a function and paste the output in another function?

2 vues (au cours des 30 derniers jours)
Zana Taher
Zana Taher le 8 Fév 2019
Commenté : Zana Taher le 8 Fév 2019
Suppose the output of your first function is y1=x^2, and the input of your second function is y2=y1+10. How can I copy only the charechters "x^2" and paste that in y2?

Réponses (1)

Kevin Phung
Kevin Phung le 8 Fév 2019
function y1 = func1(x)
y1 = x^2
end
function y2 = func2(x)
y2 = x+10
end
y2 = func2(func1(2)) % if x=2
  4 commentaires
Zana Taher
Zana Taher le 8 Fév 2019
The reason I am interested in this approach is that this approach reduces the computational time by a great factor!
Zana Taher
Zana Taher le 8 Fév 2019
Not really the syms. I am actually using syms in the first function. I am also using subs() but is also somputationally expensive.
I just need that copy paste feature!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by