Why is the animation not working?

3 views (last 30 days)
Christopher
Christopher on 24 Nov 2014
Edited: Christopher on 24 Nov 2014
Hi! I want to animate a geostruct (using mapping toolbox). Therefore i use the geoshow-function witch return an hggroup as graphics-object. The idea was to realize the animation by an hgtransform.
But it's not working. The point is shown by geoshow but is not moving to the left, as it has to do.
I'm getting a warning: "Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details."
which comes up in the line
vec = geoshow(vehicle_pos, 'SymbolSpec', specVecpos);
Here's the Code:
fig = figure;
ax = gca;
hold(ax, 'on');
specVecpos = makesymbolspec('Point',{'Default','Marker','o','MarkerSize',5,...
'MarkerEdgeColor', 'cyan', 'MarkerFaceColor','cyan'});
lon_start = 10.89025;
lat_start = 52.41037;
lon_cur = lon_start;
lat_cur = lat_start;
vehicle_pos = struct('Geometry', 'Point', 'Lon', lon_start, 'Lat', lat_start, 'Id', 0);
vec = geoshow(vehicle_pos, 'SymbolSpec', specVecpos);
% hold off;
t = hgtransform('Parent',ax);
set(vec,'Parent',t);
for i = 1:100
lon_cur = lon_cur - 0.1*lon_start;
lat_cur = lat_cur - 0.1*lat_start;
vehicle_pos.Lon = lon_cur;
vehilce_pos.Lat = lat_cur;
m = makehgtform('translate',lon_cur-lon_start,lat_cur-lat_start,0);
t.Matrix = m;
drawnow update;
pause(0.5)
end

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!