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!