Issues with graph plotting on to of itself
Afficher commentaires plus anciens
I appear to have a problem comprehending the hold situation for figures, as the output from export_fig and the figures that flash up are a mixture of differing elements; it is not keeping the graphs separate either between the two requested in the code or as the code loops. I am getting the right filenames and number of files but the graphs are all very confused.
for k = 1:numel(C)
dtF = sprintf('dt%s.csv',C{k});
xyF = sprintf('xy%s.csv',C{k});
vxF = sprintf('vx%s.csv',C{k});
dt = readtable(fullfile(D,dtF));
xy = readtable(fullfile(D,xyF));
vx = readtable(fullfile(D,vxF));
axis equal
XAxisLocation = 'origin';
YAxisLocation = 'origin';
hold
scatter(xy.x,xy.y, '.');
plot(dt.x1, dt.y1,"O", "markerFaceColor", "r", "markerEdgeColor", "r", "markerSize", 8);
plot(dt.x2, dt.y2,"O", "markerFaceColor", "r", "markerEdgeColor", "r", "markerSize", 5);
title('Particle path over time')
xlabel('x')
ylabel('y')
export_fig(sprintf('xy%s.png', C{k}));
hold
hold
XAxisLocation = 'bottom';
YAxisLocation = 'right';
scatter(vx.x,vx.vx, '.');
title('Velocity of particle in the x direction when y = 0 and x < 0')
xlabel('x')
ylabel('Vx')
export_fig(sprintf('vx%s.png', C{k}));
hold
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!