- 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
18 ビュー (過去 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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!