MATLAB: How to give a title and axes names to the graph generated by the XY Graph Block In Simulink

simulinkxy graph

I am using Simulink for a certain co-simulation as a part of my project. The results to my work can be best explained through a bunch of XY Graphs generated in Simulink. The only downside is I am unable to change the axes names and the graph title as seen in the Graph Window. Is there a way to do this? It would greatly help me compile my results faster.
If it is not possible, kindly give me other alternatives if any.
Thanks in advance.
Regards, Avinash

Best Answer

Unfortunately there is no option to automatically set the axes labels or name in figure generated by simulink X-Y graph.
However, after simulation, you can manually add axes names from figure GUI or from command window.
From Figure GUI
  • Select the X-Y graph generated by simulink. Run below cammands in command window
set(0,'ShowHiddenHandles','on')
set(gcf,'menubar','figure')
  • These commands will enable the toolbar in X-Y graph figure window. You can add axes names from Insert >> X Label and Insert >> Y Label.
From command window
After the simulation, select X-Y plot window and run these command in command window
xlabel('X_Axis_Name')
ylabel('Y_Axis_Name')
set(gcf,'name','Figure Name')