Plotting vehicleCostmap in App designer

1 view (last 30 days)
Divya Thakurani
Divya Thakurani on 31 May 2021
Answered: Sanchari on 3 May 2024
Hello all,
I am working on parking area designer using matlab.
i want to show my vehicle cost map on app designer plot window. but i am getting error "Error using plot Data must be numeric, datetime, duration or an array convertible to double."
could any one guide me how to solve this problem?
Any lead will be really supportive me for me!!
Thanks

Answers (1)

Sanchari
Sanchari on 3 May 2024
Hello Divya,
The error message indicates that the data you're attempting to plot is not in a format that MATLAB's plot function can handle. To resolve this issue, you need to ensure that the data you're trying to plot is numeric, datetime, duration, or an array that can be converted to a double type. Here are several steps and checks you can perform to troubleshoot and solve this problem:
1. Check the Data Type: Verify the data type of the variables you’re trying to plot by using “whos” command. For example:
whos myVariable;
If your variable is not a numeric, datetime, or duration type, you’ll need to convert it or extract the relevant numeric data for plotting.
2. Convert or Extract Numeric Data: If your data is stored in a table, structure, or object, you might need to extract the numeric data before plotting. For instance, if your data is in a table:
numericData = table2array(myTableVariable);
plot(numericData);
For objects, you might need to access the specific property that holds the numeric data:numericData = myObject.NumericProperty;plot(numericData);
3. Ensure Compatibility with Plot Function: The plot function typically expects vector.
Please refer to the following links to know further about related queries:
  1. Plot function (Mathworks documentation): https://in.mathworks.com/help/matlab/ref/plot.html?searchHighlight=plot&s_tid=srchtitle_support_results_1_plot
  2. vehicleCostmap planner straight line 90 degrees path (ML Answer): https://www.mathworks.com/matlabcentral/answers/1947643-vehiclecostmap-planner-straight-line-90-degrees-path?s_tid=answers_rc1-2_p2_MLT
  3. vehicleCostmap (Mathworks documentation): https://www.mathworks.com/help/driving/ref/vehiclecostmap.html?s_tid=answers_rc2-2_p5_MLT
Hope this helps!

Community Treasure Hunt

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

Start Hunting!