how to delete the units from a plot

7 visualizaciones (últimos 30 días)
sebastiaan maes
sebastiaan maes el 8 de Nov. de 2019
Respondida: Kavya Vuriti el 11 de Nov. de 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
gdxg.JPG

Respuesta aceptada

Kavya Vuriti
Kavya Vuriti el 11 de Nov. de 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

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by