diff --git a/plotly/makegallery.m b/plotly/makegallery.m index 7e27fa97..6788adbf 100644 --- a/plotly/makegallery.m +++ b/plotly/makegallery.m @@ -14,7 +14,10 @@ % OutputFolder - folder in which the HTML file is written. % Default: current working directory. % Functions - cellstr of plot function names to include. - % Default: all supported functions. + % Default: all supported functions. Functions + % that do not exist in the running MATLAB/Octave + % (e.g. sombrero in MATLAB, fsurf in Octave) are + % skipped. % Visible - 'off' (default) to keep the figures hidden while % the gallery is generated, 'on' to display them. % EmbedPNG - true (default) to embed the native PNGs in the @@ -77,6 +80,14 @@ names = requested; end + available = cellfun(@isFunctionAvailable, names); + if ~all(available) + fprintf('Skipping entries not available in %s: %s\n', ... + tern(is_octave(), 'Octave', 'MATLAB'), ... + strjoin(names(~available), ', ')); + names = names(available); + end + fprintf('Generating Plotly gallery with %d entries ...\n', numel(names)); js = resolvePlotlyJS(lower(opts.PlotlyJS)); @@ -650,6 +661,10 @@ end end +function tf = isFunctionAvailable(name) + tf = exist(name, 'file') ~= 0 || exist(name, 'builtin') ~= 0; +end + function out = tern(cond, a, b) if cond out = a;