Error message I don't understand

2 次查看(过去 30 天)
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