surf in for loop crashes matlab?

조회 수: 2 (최근 30일)
koji takahashi
koji takahashi 2011년 12월 22일
hello, i'm trying to use surf in a for loop to show the cross section of all the surfaces which are stored (as matrices) within a struct. i'm using R2010b on a UNIX machine. About half the time that I run this part of the code, matlab crashes and the core_dump file is empty. The Z matrices all have the same XY dimensions, hence the same X and Y matrices are used within the loop. Any ideas?
The code is as follows:
figure(1)
hold on;
offset = 0; % value to offset each surface map in the for loop
for i=1:numel(maps)
% show all surfaces with colormap defined by Z_matrix, and offset by give value
surf(X_matrix, Y_matrix, maps{i}.Z_values + offset, maps{i}.Z_values);
offset = offset + 100;
end
view([0 50 0]);
hold off
THANKS!

답변 (3개)

Walter Roberson
Walter Roberson 2011년 12월 22일
It probably isn't the surf() itself, but rather the fact that because you have "hold on", all of the graphics information for all of the surf plots is accumulating in memory.
How big are your matrices, and how many of them are you plotting?

koji takahashi
koji takahashi 2011년 12월 22일
not that big, i think. about 20 30x30 matrices. that shouldn't chew up memory should it?

koji takahashi
koji takahashi 2011년 12월 23일
is there a better way to do this?
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 12월 23일
Not that I can think of at this time?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by