MATLAB: Update the Legend dataN value in GUI

guilegendMATLABplotsecond order systems

Hi All,
I was following a training video on how to learn to make a GUI(Basic) on a second order dynamic system, using zeta as a variable. I want display the value of zeta everytime I ran the simulation. but I only get dataN values. I have attached the files created as part of the training video – I added the legend commands trying to make it work, but di not work!
Thanks for your help!
Gera

Best Answer

legend(sprintf('\\zeta = %g',zeta), 'interpreter', 'latex');
Notice the \\