how to delete the units from a plot
9 views (last 30 days)
Show older comments
sebastiaan maes
on 8 Nov 2019
Answered: Kavya Vuriti
on 11 Nov 2019
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

0 Comments
Accepted Answer
Kavya Vuriti
on 11 Nov 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!