Error message I don't understand
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (2)
Voss
le 8 Juil 2022
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.
0 commentaires
Benjamin Kraus
le 8 Juil 2022
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 commentaires
Benjamin Kraus
le 8 Juil 2022
Modifié(e) : Benjamin Kraus
le 8 Juil 2022
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.
Voir également
Catégories
En savoir plus sur Detection, Range and Doppler Estimation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!