how to delete the units from a plot

12 次查看(过去 30 天)
Hi,
I would like to change the x-as to my own text (for example: frequentie [°] ). I did this by de command object.XLabel.String = 'Frequentie [°]'. When I plot my graph I got this: 'Frequentie [°] (deg)'. What option do I need to disable to get rid of the '(deg)' after it?
My code:
opts3 = bodeoptions('cstprefs');
opts3.Title.String = 'Black diagram';
opts3.XLabel.String = 'Fase [°]';
opts3.YLabel.String = 'Versterking (db)';
opts3.grid = 'on';
nichols(g1,opts3) % black diagram
gdxg.JPG

采纳的回答

Kavya Vuriti
Kavya Vuriti 2019-11-11
Hi,
There is no option to get rid of units being displayed after X-label and Y-label using Toolbox Preferences Editor. Replacing text using regular expression may help.
fig = figure;
opts3 = bodeoptions('cstprefs');
opts3.Title.String = 'Black diagram';
opts3.XLabel.String = 'Fase [°]';
opts3.YLabel.String = 'Versterking (db)';
opts3.grid = 'on';
nichols(g1, opts3)
labels = findall(fig,'Type','Text');
label = labels(strncmp(get(labels,'String'),'Fase [°]',8));
set(label,'String',regexprep(get(label,'String'),'(\(\w*)\)',''));
Refer to the following link for more information on regexprep:https://www.mathworks.com/help/matlab/matlab_prog/regular-expressions.html#btrug0n-1

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by