- publish works as it should
- some details of the documentation are easy to miss
- the output to pdf doesn't look as nice as does the html-output
Publish Problem in PDF
10 次查看(过去 30 天)
显示 更早的评论
Hello.
I have tried to publish my work, but I just get out in the output just a small part of my work. No figures is not either displayed in the output.
Why can't I publish all my code? I have tried for hours to figures this out, but now I feel I need your help on MATLAB Central.
I want to publish my work in pdf.
Please, help me. What am I doing wrong here?
Kind regards Cillian
4 个评论
per isakson
2012-9-1
The code you provide includes three independent functions. I created three m-files. None of the three outputs anything to the screen.
How am I supposed to use these functions?
采纳的回答
per isakson
2012-9-1
编辑:per isakson
2012-9-1
You have provided three main functions
- forwardEuler
- backwardEuler
- mittpunkten
which you want to publish to one file.
You say "For some reason, the code is not displayed.", but you don't tell what you do to publish the functions and you do not say exactly what you expect. Thus, you rely on us guessing.
You say "No figures is not either displayed in the output.", which made me believe that you expected some kind of Matlab figure in the output. What did you try to communicate with this sentence?
AFAIK: It is not possible to publish three main functions to one document. You can, however, publish to three and merge to one.
I have created three m-files, one of which contains
% Method 1
function [t,U]=forwardEuler(f,I,U0,N)
if nargin == 0
return
end
t=linspace(I(1),I(2),N+1);
U=zeros(length(U0),size(t,2));
U(:,1)=U0;
k=t(2)-t(1);
for n=2:N+1
U(:,n)=U(:,n-1) + k*f(t(n-1),U(:,n-1));
end
U=U';
t=t';
end
.
My tests (R2012a):
>> publish('forwardEuler')
ans =
h:\m\cssm\html\forwardEuler.html
this html-file contains a grey box with the code as I expect.
>> publish('forwardEuler','pdf')
ans =
h:\m\cssm\html\forwardEuler.pdf
the pdf-file looks ok to me.
Clicking the button, "Publish forwardEuler.m", in the toolbar creates an identical html-file and opens it in the Matlab browser.
7 个评论
Walter Roberson
2012-9-4
Could you outline the solution for others that might encounter this problem?
per isakson
2012-9-4
I haven't a clue what caused or solved the problem and our communication in Swedish doesn't even provide a hint.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!