Reputation: 11
I wrote code that plots 2 subplots, a 3D surface plot and a 2D contour plot. However, the variables/vectors used in the plots change and I need to re-plot them. Here is what I have so far. I keep getting and error and MATLAB crashes every time I run the code.
Plot that works:
subplot(2,1,1);
plotHandle = surf(xMeters(xStart:xEnd),yMeters(yStart:yEnd),ELEV(yStart:yEnd,xStart:xEnd));
subplot(2,1,2);
contour(xMeters,yMeters,ELEV);
hold on;
plotHandle2 = plot(xTop,yTop,'b');
plotHandle3 = plot(xBottom,yBottom,'b');
plotHandle4 = plot(xLeft,yLeft,'b');
plotHandle5 = plot(xRight,yRight,'b');
hold off;
Then I try to re-plot it after doing some operations on the variables/vectors and this is where it breaks down:
subplot(2,1,1);
set(plotHandle,'XData',xMeters(xStart:xEnd));
set(plotHandle,'YData',yMeters(yStart:yEnd));
set(plotHandle,'ZData',ELEV(yStart:yEnd,xStart:xEnd));
subplot(2,1,2);
set(plotHandle2,'XData',xTop);
set(plotHandle2,'YData',yTop);
set(plotHandle3,'XData',xBottom);
set(plotHandle3,'YData',yBottom);
set(plotHandle4,'XData',xLeft);
set(plotHandle4,'YData',yLeft);
set(plotHandle5,'XData',xRight);
set(plotHandle5,'YData',yRight);
drawnow;
Can anyone please help?
Upvotes: 0
Views: 94
Reputation: 2315
Matlab crashing, when you are not using mex or other external interfaces, would be a case for contacting Mathworks customer support.
Upvotes: 0