Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion plotly/makegallery.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down
Loading