how to delete the units from a plot
9 ビュー (過去 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

0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!