How to save contourf data and not plot it for running efficiency?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have prepared data for finding a contour line on the contour map. However, I have to run thousands of simulations and most of the computation is used in opening and closing the figure. Is there a way that I can just save the contourf into the variable 'c' and not plot it.I am attaching the screenshot for your reference

I have attached the grid files in 'grid_data.mat' but it does not load in the online version. The code for my approach to plotting is given below:
load('grid_data.mat')
[c] = contourf(x1nan,y1nan,uanan,[33.33 33.33], 'ShowText','on',FaceAlpha=0.1,EdgeAlpha=0.8,EdgeColor='k',LevelStep=20);
I cannot get to load the file in this code, but I have attached it. Please let me know what i am doing wrong Than you in advance.
댓글 수: 1
Star Strider
2024년 12월 13일
Answers is having problems with uploaded files.
I first noticed this two days ago and MathWorks knows about it. Apparently, it has not been fixed yet. (For whatever reason, we don’t have permission to access the uploaded files. Here, it mentiions that the file cannot be found. Using the websave function reveals that the file exists, however access to it is ‘Forbidden’, according to the error that is thrown when attempting that.)
file = websave('grid_data.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1820915/grid_data.mat')
MathWorks has been doing site maintenance recently. That apparently broke this capabiity (and a number of others).
.
채택된 답변
Star Strider
2024년 12월 13일
편집: Star Strider
2024년 12월 13일
Example —
[X,Y,Z] = peaks(50);
figure
[c,hc] = contourf(X,Y,Z, ShowText='on');
colormap(turbo)
colorbar
c % Contour Information
figure
[c,hc] = contourf(X,Y,Z);
c % Contour Information
Ax = gcf;
Ax.Visible = 'off'; % Figure Not Displayed
EDIT — Added second documentation reference (Visible).
.
댓글 수: 4
Star Strider
2024년 12월 14일
As always, my pleasure!
If you siimply want to over-write the figure in the next iterration, there is no need to close it first. Over-wertinng it will do essentially the same operation.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!