Matlab gets stuck in publish function

141 views (last 30 days)
Kelton George
Kelton George on 5 Feb 2018
Answered: Jeremy Thomas on 19 Mar 2018
I'm trying to use the Matlab publish command to make my code into a pdf, but it gets stuck in an infinite loop while attempting to publish where I have to use control-c to get out. Here is my code and the output in the command window after I manually exit from the codes is below.
clc; clear; close all;
N = 50; %mols
Vo = 10;% L initial volume
ya = 0.5; %vapor fraction
delta = 2;
epsilon = ya*delta;
Nao = N*ya;
k = 0.45;
t = 60; %time
Cao=Nao/Vo;
Xa = 2/(Vo/(Nao*(k*t+1/Cao))+1)-1;
XA = (Cao*k*Nao*t-Cao*Vo+Nao)/(Cao*k*Nao*t+Cao*epsilon+Nao);
fprintf('The conversion for isobarically condition %.6f \n',Xa)
Constant Voume
Xa2 = 1-(k*t*Cao)^-1;
fprintf('The conversion for isochoric condition %.3f \n',Xa2)
%%Concentration Figure
tc = linspace(1,60);
Xac = 2./(Vo./(Nao.*(k.*tc+1./Cao))+1)-1;
Xac2 = 1-(k.*tc.*Cao).^-1;
figure(1);
plot(tc,Xac,tc,Xac2,'LineWidth', 2)
xlabel('Time (s)'); ylabel('Conversion X');
title('Conversion Vs Time of Reactors');
legend('Isobaric','Isochoric','Location','Best'); axis tight; grid on;
set( gca, 'FontSize', 16 )
saveas(figure(1),'Problem3Conversion.png')
publish('Hw3_problem3.m')
end
The command window displays this after forcing to exit from running
Operation terminated by user during alternatePrintPath
In print (line 82)
pj = alternatePrintPath(pj);
In saveas (line 181)
print( h, name, ['-d' dev{i}] )
In Hw3_problem3 (line 37)
saveas(figure(1),'Problem3Conversion.png')
In evalmxdom>instrumentAndRun (line 109)
text = evalc(evalstr);
In evalmxdom (line 21)
[data,text,laste] = instrumentAndRun(file,cellBoundaries,imageDir,imagePrefix,options);
In publish
In Hw3_problem3 (line 39)
publish('Hw3_problem3.m')
In evalmxdom>instrumentAndRun (line 109)
text = evalc(evalstr);
In evalmxdom (line 21)
[data,text,laste] = instrumentAndRun(file,cellBoundaries,imageDir,imagePrefix,options);
In publish
In Hw3_problem3 (line 39)
publish('Hw3_problem3.m')

Answers (2)

Jeremy Thomas
Jeremy Thomas on 19 Mar 2018
It looks like you're calling publish inside the file you're trying to publish. Remove publish from the script and call publish on the script from the matlab command line.

Chetna Jain
Chetna Jain on 21 Feb 2018
Hi Kelton ,
I have informed the development team about this issue. They are looking into it.
Meanwhile , You can use the "publish" method(line 39, as per what I see in above post) outside the "Hw3_problem3" file i.e from MATLAB prompt after removing it from file.

Categories

Find more on File Operations 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!