Is there a contourc equivalent for contourm?
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I would like to compute contours on geotiffs without producing a plot. For regular rectangluar data 'contour' will compute the contours and plot them, and 'contourc' function will just compute the contours and return the contour matrix without plotting. It appears the geographic contour function 'contourm' works like 'contour' and produces a plot, I would like to get the contours without generating a plot.
Right now my solution is this:
set(0,'DefaultFigureVisible','off');
altContour = contourm(geoData,geoRef,'LevelList',geoAltitude,'Visible','off');
close(gcf);
set(0,'DefaultFigureVisible','on');
But this is still incurring overhead penalties for setting up the figure... I would ideally like a function like 'contourmc'. Is there some function, even internal or undocumented, that I can use to achieve this?
1 Commento
Andrew Wind
il 20 Nov 2025 alle 19:27
I have also been using a similar method to suppress making the figure visible and then closing it, but this doesn't answer the original question.
Is there another function or option that will calculate the result without the overhead of plotting an invisible figure in the background?
Risposte (2)
Pavan Sahith
il 12 Ott 2023
Hi Mark,
I understand you would like to compute contours on geotiffs without producing a plot.
You can use the ‘contourm’ function in this way to achieve the contour matrix without plotting.
% Example data
[X, Y, Z] = peaks;
% Define the desired contour levels
contourLevels = [-5, -3, -1, 1, 3, 5];
% Create a temporary invisible figure to capture the contour data
hFig = figure('Visible', 'off');
% Use contourm to capture the contour data
[ccontourData] = contourm(Y, X, Z, contourLevels)
% Close the temporary figure
close(hFig);
% contourData contains the contour lines and levels without displaying the plot
Please refer to the MathWorks Documentation to know more about
Hope it helps .
0 Commenti
Walter Roberson
circa 19 ore fa
Modificato: Walter Roberson
circa 19 ore fa
You can make the contourm() call within a Process based parallel pool (such as using parfeval()).
This has notable overhead... but no visible figure will be generated.
Note: contourm() is not supported on backgroundPool
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!