The radar auto driving example could not get the result I expected

1 view (last 30 days)
Hi, experts,
I am using R2024a and trying to run the example of AutomatedDrivingRadarSimulationExample by running the two commands below in the Command Window of matlab:
>> openExample('driving_radar/AutomatedDrivingRadarSimulationExample')
>> AutomatedDrivingRadarSimulationExample
After running the example, I observed a plot (see SNRplot.png attached), but could not see the radar image (see RadarImage.png attached) which I expected. Any expert knows if I missed anything? How should I do (Do I need to modify matlab script in the example), in order to see the radar image (RadarImage.png attached)?
Running the attached matlab code got the same result: you can see a SNR plot, but not the radar images.
Many thanks!
  2 Comments
Naga
Naga on 22 Aug 2024
Did you make any changes to the example model, or did you just run the same model?
Xuedong
Xuedong on 22 Aug 2024
Hi, Naga,
Thank you for your help. Now I can run the example.
I ran the example in the following 2 different ways, and got the same result:
1.In the matlab Command Window, I ran the example by issuing the following 2 commands:
>> openExample('driving_radar/AutomatedDrivingRadarSimulationExample')
>> AutomatedDrivingRadarSimulationExample
2.I copied all matlab code pieces from the example in the following link into the file Radar_image.m (see attached in my original question message).
In the Radar_image.m file, I only added the following line at the beginning of the file to declare the path of the example so that the matlab can find the helper funtions needed for the example.
addpath('C:\Users\HP\Documents\MATLAB\Examples\R2024a\driving_radar\AutomatedDrivingRadarSimulationExample\')
Then I ran Radar_image.m.
I observed the same result, no matter which way I ran the example:
Only the SNR plot is shown on my PC. No radar images are shown on my PC, though I expected that radar images are shown on my PC.

Sign in to comment.

Accepted Answer

Jatin
Jatin on 22 Aug 2024
You are correct that two figures are generated as part of the example, but on running the model you can only see the SNR plot and not the Radar Image.
This happens because the code is intended to run that way.
If you take a look at the “helperAutoDrivingRadarSigProc.mfile and scroll down to the definition of function “publishSnapshot” shown in the image below.
As suggested by the comments, the function intentionally closes the figure after using the snapnow command which takes the snapshot of the image for inclusion in the live script output.
As a workaround, if you want both figures to appear in separate figure windows, kindly go on and comment the line where function “close” is called.
Saving the function and running the script again will give you the desired results.
  1 Comment
Xuedong
Xuedong on 22 Aug 2024
Thank you very much for your detailed and clear guidance. Now I can see the radar image by commenting out the close(fig) line.

Sign in to comment.

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!