Error message I don't understand

조회 수: 2 (최근 30일)
John Figueroa
John Figueroa 2022년 7월 8일
편집: Benjamin Kraus 2022년 7월 8일
When working an example application, I get the error message below when working with the prgram in the Live Editor mode:
"error using xline" and "must be a scalar"
which then points to the line below, which I have bolded, in the suppoting function: helperPlotStripmapMode, which is part of the program example of the Airborne SAR System Design under the Radar Applications of the Radar Toolbox.
xline(azres,'-.',{[num2str(round(azres)),' m']}); % Selected azimuth resolution
Can someone help me understand what this error means and how to correct it? It is preventing me from executing the remainder this learning exercise.
Thank you in advance.
John Figueroa

답변 (2개)

Voss
Voss 2022년 7월 8일
I believe some older versions of MATLAB require the first argument to xline to be a scalar. To get around that, you can call xline multiple times in a for loop:
azres = [1 2];
for ii = 1:numel(azres)
xline(azres(ii),'-.',{[num2str(round(azres(ii))),' m']}); % Selected azimuth resolution
end
xlim([0 3])
However, looking over the example program you're following, it seems to me like azres is a scalar, so you should check that your code is the same as the example code.

Benjamin Kraus
Benjamin Kraus 2022년 7월 8일
I think that error message means that the first input to xline was an empty vector. Have you modified the example at all in a way that might make the first input to xline an empty vector?
  댓글 수: 2
John Figueroa
John Figueroa 2022년 7월 8일
Yes Benjamin,
I did modify the example by changing the values of the required slant range and azimuth resolutions, the maximum unambiguous range, the proability of detection, velocity, and radar altitude in the design specifications section. Are those quantitative changes to those variables responsible for the error message? And is the first input to xline, that you reference, azres?
Thank you.
Benjamin Kraus
Benjamin Kraus 2022년 7월 8일
편집: Benjamin Kraus 2022년 7월 8일
Yes, the first input to xline is azres. I don't know enough about the subject matter to know how your changes are impacting the value of azres, but if I had to guess your changes are causing azres to become empty, which is triggering this error message.
My suggestion would be to modify the call to xline in the helper function called helperPlotStripmapMode (at the bottom of the Live Script) to add a check for empty.
Basically, modify this one line:
xline(azres,'-.',{[num2str(round(azres)),' m']}); % Selected azimuth resolution
To look like this:
if ~isempty(azres)
xline(azres,'-.',{[num2str(round(azres)),' m']}); % Selected azimuth resolution
end
This will skip the call to xline if azres is empty.
You may need to make other adjustments to the helper function if you encounter other errors, but this should get you past this specific error message.

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

카테고리

Help CenterFile Exchange에서 Detection, Range and Doppler Estimation에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by