publish command results in images 1px by 0px

1 view (last 30 days)
Hi,
I've got a file that I'd like to publish, and another file I'm using to do the publishing. The original file is as such:
%% test_file.m
% Test file to see if plots are correct
% Plots have been coming out with size 1px by 1px or 1px by 0px
figure;
plot([0 1], [0 1]);
The publishing code that I run is as follows:
% publishing_code.m
file_to_publish = 'test_file.m';
options.showCode = true;
options.evalCode = true;
options.format = 'html';
publish(file_to_publish, options);
close all;
The issue I'm having on one of my computers is, the figures all come out with size 1px by 1px, or 1px by 0px. I'm guessing some other piece of code that I run on startup, or one of the plotting functions I wrote, is messing with the size somewhere, but I'm not quite sure what to look for. Do y'all have any ideas? Thank you.

Accepted Answer

John Doe
John Doe on 22 Apr 2020
Figured it out - I have some code that does set(0, 'Units', 'Normalized') and doesn't set it back to pixels; this produces an issue in Matlab 2017's publishing code, specifically in evalmxdom.addImageSizes. Here, if the units are normalized, scale comes out to pixel number, and so scaledDims become either 0 or 1 depending on how they're rounded.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!