- #1

cookiemnstr510510

- 162

- 14

- TL;DR Summary
- Hello All, I am trying to create a MATLAB Gui that works by taking the derivative of a function and displays the result.

Hello!

Happy Sunday, I am trying to create a MATLAB GUI that can take an input ( i am starting out with just one variable) and take its derivative and display the result. I have attached pictures of what my GUI looks like, and also the code I wrote so far.

Let me also describe my method:

I have added

1 edit text box whose tag line is "FCN"

1 pushbutton whose tag line is "equalPushButton"

1 static text box whose tag line is "first", the static text box is blue in the picture attached.

I am running into some problems and I think I know why, but cannot seem to figure out how to fix it. Here is what I did

I went to the callback of the pushbutton and added:

syms x (I did this because I was thinking I had to define the variable..?)

a=get(handles.FCN,'string') This is getting the value from the edit text box

b=str2num(diff(a));

set(handles.first,'string',num2str(b));

As an example I would like my program to be able to handle "4x" as an input and when you hit the push button spit out "4" in the static text box (without the quotes).

I believe the problem is somehow I am not telling MATLAB that we have numbers and letters being typed into the edit text box...

I am new to MATLAB and it is pretty difficult to me so any help would be appreciated. The simpler the explanation the better for me.

Thank you!

Happy Sunday, I am trying to create a MATLAB GUI that can take an input ( i am starting out with just one variable) and take its derivative and display the result. I have attached pictures of what my GUI looks like, and also the code I wrote so far.

Let me also describe my method:

I have added

1 edit text box whose tag line is "FCN"

1 pushbutton whose tag line is "equalPushButton"

1 static text box whose tag line is "first", the static text box is blue in the picture attached.

I am running into some problems and I think I know why, but cannot seem to figure out how to fix it. Here is what I did

I went to the callback of the pushbutton and added:

syms x (I did this because I was thinking I had to define the variable..?)

a=get(handles.FCN,'string') This is getting the value from the edit text box

b=str2num(diff(a));

set(handles.first,'string',num2str(b));

As an example I would like my program to be able to handle "4x" as an input and when you hit the push button spit out "4" in the static text box (without the quotes).

I believe the problem is somehow I am not telling MATLAB that we have numbers and letters being typed into the edit text box...

I am new to MATLAB and it is pretty difficult to me so any help would be appreciated. The simpler the explanation the better for me.

Thank you!