Print a Matlab Expression as Text
Afficher commentaires plus anciens
Hey,
I am creating a GUI in which I would like to display an equation as text.
For example, I have the expression:
z = (z).^2+c;
I would like to print the '(z).^2+c' part of this expression so the user knows which equation is selected.
Is this possible to do?
Thanks,
Ben G
7 commentaires
dpb
le 24 Déc 2019
Where is this expression coming from and how is it presently stored?
If it is an equation/expression in a text field input by the user, for example, then
>> xpr='z = (z).^2+c;';
>> sprintf(strtrim(xpr(strfind(xpr, '=')+1:end)))
ans =
'(z).^2+c;'
>>
Image Analyst
le 24 Déc 2019
Maybe try echo???
echo on;
z = (z).^2+c;
echo off
Lines of code that are executed while echo is on will display in the command window.
Benjamin Gutierrez
le 24 Déc 2019
Walter Roberson
le 24 Déc 2019
str2func() to move from a character vector to a function handle.
Benjamin Gutierrez
le 25 Déc 2019
Walter Roberson
le 25 Déc 2019
str2func() is more robust than eval()
Benjamin Gutierrez
le 25 Déc 2019
Réponses (0)
Catégories
En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!