I want to portrait different math equation (latex) in static text (Tag:Eqn), according to the choice in pop up menu(Tag:popupmenu1). Somehow, the textbox showed a number that increase for one unit every time I click on the choice in the pop up menu. I used the command

D ='$$z = c^{2} - \frac{c^{2}}{a^{2}}x^{2} - \frac{c^2}{b^2}y^{2}$$'; E = text(0,0,D,'interpreter','latex'); set(handles.Eqn,'String',E);

Then, I tried to change the static box to plot, to check if I was able to key in math equation. I typed the following command under the plot's Callback function.

D ='$$z = c^{2} - \frac{c^{2}}{a^{2}}x^{2} - \frac{c^2}{b^2}y^{2}$$'; E = text(hObject,0,0,D,'interpreter','latex'); annotation(hObject,'textbox',0,0,'string',D,'interpreter','latex');

Still, I am unable to get the text with or without the third line.

Please help. If possible, I wish to portrait the equation in static textbox. I am using MATLAB R2015a.

Thank you.