MATLAB: How to change the “xlabel” and “ylabel” properties of the XY GRAPH block in Simulink 6.4 (R2006a)

label;simulink

I am using the XY GRAPH block in my Simulink model and want to change the “xlabel” and the “ylabel” of the generated plot.

Best Answer

The ability to modify the “xlabel” and “ylabel” of the plot generated by XY GRAPH block is not available in Simulink.
To work around this issue, obtain the handle to the Xlabel / YLabel and set its 'String' property to the desired label. For an example of modifying the "ylabel", execute the following command in the MATLAB command window, after execution of the model:
set(0,'showhiddenhandles','on');
h=get(gca,'YLabel');
set(h,'String','MyYLabel');
The above code changes the “ylabel” to 'MyYLabel'. Also, this piece of code may be included in the 'StopFcn' callback of the model.