Figures not publishing to PDF, snapnow throwing errors

My code yeilds the result I want on screen, but I'm not getting any of the figures in the published PDF file. I tried using "snapnow", but it's just giving me a bizarre error that I can't make out.
This code:
function homework_5()
plot_transfer(1);
plot_transfer(10);
plot_transfer(100);
end
function plot_transfer(k)
T = get_transfer(k);
[u,t] = get_ramp();
name = sprintf('k=%d',k);
figure('Name',name,'NumberTitle','off');
lsim(T,u,t);
snapnow;
end
function transfer = get_transfer(k)
transfer = tf([k],[1 1 0]);
end
function [u,t] = get_ramp()
u = (0:.01:1)';
t = u;
end
Yeilds 3 instances of this pile of errors:
Error in snapnow (line 152)
iCell = cellStack(end);
Error in homework_5>plot_transfer (line 15)
snapnow;
Error in homework_5 (line 6)
plot_transfer(100);
Error in evalmxdom>instrumentAndRun (line 109)
text = evalc(evalstr);
Error in evalmxdom (line 21)
[data,text,laste] = instrumentAndRun(file,cellBoundaries,imageDir,imagePrefix,options);
Error in publish
Error in mdbpublish (line 55)
outputPath = publish(file, options);
Anyone know what's going on?

2 Comments

Why do you need snapnow if you're already using publish?
For some reason the figures are not showing in the published file.

Sign in to comment.

Answers (0)

Asked:

on 10 Oct 2019

Commented:

on 11 Oct 2019

Community Treasure Hunt

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

Start Hunting!