필터 지우기
필터 지우기

Is there a way to programmatically "print" the window of the dsp.SpectrumAnalyzer to a JPG or PNG file?

조회 수: 6 (최근 30일)
I have previously used the print function in a script to get a JPG or PNG file from a figure. Now I am running a script and presenting information on the dsp.SpectrumAnalyzer, and I'd like to get the window of the spectrum analyzer to a JPG or PNG file including the measurement data. Is there a programatic method to do this?

채택된 답변

Devineni Aslesha
Devineni Aslesha 2020년 3월 23일
편집: Devineni Aslesha 2020년 3월 23일
Use the below code to get the spectrum analyzer window to a JPG or PNG file including the measurement data programmatically.
scope = dsp.SpectrumAnalyzer;
scope.CursorMeasurements.Enable = true;
scope.ChannelMeasurements.Enable = true;
scope.PeakFinder.Enable = true;
scope.DistortionMeasurements.Enable = true;
scope(randn(5000,3));
specFigHdl = findall(0,'Type','figure','Tag','spcui_scope_framework');
print(specFigHdl, 'rSpecAnalyzer', '-djpeg');
  댓글 수: 1
Richard Keniuk
Richard Keniuk 2020년 3월 23일
Thanks Devineni,
Got my figure printed to JPG. I added the property "InvertHardcopy" and set it to "off" to make sure the JPG picture is identical in color to my screen figure (default fills the background of the graph with white).
I was getting an error when I tried this:
specFigHdl = findall(0,'Type','figure','InvertHardcopy','off','Tag','spcui_scope_framework');
print(specFigHdl, 'rSpecAnalyzer', '-djpeg');
but I did find that the following works:
specFigHdl = findall(0,'Type','figure','Tag','spcui_scope_framework');
specFigHdl.InvertHardcopy = 'off';
print(specFigHdl,'rSpecAnalyzer', '-djpeg');
Thanks for your help. Maybe you can comment on this syntax?

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by