Patch problems

Skip to first unread message

Charles L Hakes

Apr 20, 2022, 12:53:53 PM4/20/22
to Robotics & Machine Vision Toolboxes
Hi all,

Any help for Mac users with odd things getting sent to “patch” from

Working on chapter 6 of the text getting a robot to drive around and use a sensor to get position updates, there is an error in the “patch” routine that looks like it is whatever just draws the little triangle for the robot.  This showed up for me a couple of years ago in Matlab version 2019a, but was fixed going to 2020a.  Now it looks like it is broken again in 2021a.  But only on my Mac (OS10.14.6).  (This install has limited Matlab add-ons.)  It works in 2021a on a Windows machine that has every possible add-on installed.  And I just got a newer Mac (OS12.1) and tried Matlab 2022a and get the same error. Could I simply be missing a Matlab add-on that uses a different “patch"?

Anybody else encounter this or come up with a work around?


Here is my code:
%% Chapter 6 localization


%% Add a Map (section 6.2)


% set covariance diagonals (know your starting location well)
P0 = diag([0.005, 0.005, 0.001].^2);
V = diag([0.02, 0.5*pi/180].^2);
W = diag([0.1, 1*pi/180].^2);


% Add a Map (section 6.2)
map = LandmarkMap(20,10);


veh = Bicycle('covar', V);
veh.add_driver( RandomPath(map.dim) );
sensor = RangeBearingSensor(veh, map, 'covar', V, 'angle',[-pi/2 pi/2],'range', 4, 'animate');
ekf = EKF(veh, V, P0, sensor, W, map);
% This is the command that actually does the running.;


% This shows what you did


This error shows up in 2021a when it gets to the; line.

Error using patch
Unrecognized property axis for class Patch.

Error in plot_poly (line 149)
                h = patch(x', y', opt.fillcolor, ...

Error in plot_vehicle>draw_robot (line 220)
        h = plot_poly(corners, 'animate', 'axis', opt.axis, args{:});

Error in plot_vehicle (line 117)
        h.vehicle = draw_robot(d, opt, args);

Error in Vehicle.plotv (line 547)
            h = plot_vehicle(varargin{1}, 'fillcolor', 'b', 'alpha', 0.5);

Error in Vehicle/plot (line 419)
                veh.vhandle = Vehicle.plotv(veh.x, varargin{:});

Error in EKF/run (line 414)

Error in Ch6_Localization_with_Map_minimum (line 22);
>> which patch
built-in (/Applications/
Reply all
Reply to author
0 new messages