How does one set the line style for the plotted traces on the dsp.SpectrumAnalyzer object in the script?

조회 수: 1 (최근 30일)
When using the dsp.SpectrumAnalyzer and displaying a spectrum, the plotted trace thickness can be selected in the Spectrum Analyzer window (after the plot) by going to View > Style... and adjusting the items in the style window. The line thickness is set to 0.5 by default which I would like to set higher. Is there a way to specify the line thickness in the plotted trace to something different (like 1 or 2) in the scripted properties for the dsp.SpectrumAnalyzer rather than changing it after it's been plotted?

채택된 답변

Sachin Meena
Sachin Meena 2018년 8월 29일
Currently, the dsp.SpectrumAnalyzer by itself does not provide you with the option to change the line width. One of the possible workarounds that you can try is to find all the line objects in your plot and then change their linewidth, like following.
line=findall(0,'type','line'); %finding the line in the figure
line.LineWidth=3; %or whatever you wish it to be
Note that "gca" and "gcf" won't work on this figure unless you turn on the handle visibility property to on (by default it is off).
  댓글 수: 1
Richard Keniuk
Richard Keniuk 2018년 8월 29일
편집: Richard Keniuk 2018년 8월 29일
Thanks, worked nicely... There were two lines found with the "line=findall(0,'type','line')" command.
line =
2×1 Line array:
Line (DisplayLine2)
Line (DisplayLine1)
So second command became two commands.
line(1).LineWidth=3; line(2).LineWidth=3;

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Analysis에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by