MATLAB: Convert a text input to a mathematical equation in MatlabAppDesigner MATLABmatlabappdesignerplottext input Hello. I am trying to plot functions using Matlab AppDesigner. However, to do that I need to convert a text input to a mathematical equeation. Regards. Best Answer See str2func(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/str2func.html For more advanced cases see eval(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/eval.html however, use it carefully: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval Related SolutionsMATLAB: Convert a datatype (like string) into Simple Plain Text like a Matlab Function See str2func(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/str2func.html to convert the string to function handle.For more advanced cases, see feval(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/feval.html and eval(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/eval.html. However, use them with care and also read this: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval to see that why using them can be a bad idea if used carelessly: MATLAB: Change a string by the loop number You can, but don't...see the FAQ for some reasons why not and how to do it "the Matlab way"...http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3FThis is in terms of variables but the same holds true for function names as well. Related QuestionVariable disappears when using itPlot in MatlabAppDesigner with GUIHow to change struct name in a loopHow to add a subscript in colour map labelsHow to make dynamic variable names (A1, A2, …, An) with “for” loop? Using “eval” “num2str”Is MATLAB App Designer in place of Matlab GUI in MATLAB 2020a
Best Answer