Borrar filtros
Borrar filtros

How can i differentiate strings in GUI?

1 visualización (últimos 30 días)
Bugra Alp Nas
Bugra Alp Nas el 27 de Mzo. de 2019
Respondida: Walter Roberson el 27 de Mzo. de 2019
I've tried so much but I can't find solution. I've wrote something but not working. I'm waiting your advices or easier ways.
My code is:
f_1 = matlabfunction(get(handles.edit1,'string'));
diff(f_1);
set(handles.text3,'string',f_1);

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Mzo. de 2019
You cannot do that. You cannot differentiate character vectors (usefully) or string objects, or function handles.
Given a function handle, you could evaluate it at several locations and use the results to estimate numeric gradient.
Given a character vector, if you have the Symbolic Toolbox, you could potentially use str2sym() to create a symbolic expression that you could then differentiate with diff() . Be sure to specify the variable to differentiate with respect to. You can assign the result to a variable and char() the expression to get something that you can set() as the string property of a uicontrol.
Note: if you have R2017a or earlier, you need to use sym() instead of str2sym() . When you use sym() then the language is not exactly the same as MATLAB and it is not exactly the same as MuPAD either.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by