saving the output of diff function to a variable
显示 更早的评论
hello
i am working on GUI project i have a case that i want to use diff function in the project
the output of diff funtion is supposed to be displayed or calledback in other things
the problem is i canot find a way to save the output of th diff function to a varriable to be used later
i know that when i write >> diff x^2 ans =
2*x
what i want is to save the ans to variable in the GUI
thanks in advance nour r
回答(2 个)
Paulo Silva
2011-2-12
%In your workspace do this
MyVariable=diff('x^2');
%In your GUI do this
MyVariable = evalin('base', 'MyVariable');
%MyVariable will be a symbolic expression, if you want it in string format
MyVariable=char(MyVariable) %convert it to a string
%Converts to string but also inserts a . before any ^, * or / in s
%MyVariable=vectorize(MyVariable)
Walter Roberson
2011-2-12
0 个投票
类别
在 帮助中心 和 File Exchange 中查找有关 Operations on Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!