Publish Problem in PDF

15 次查看(过去 30 天)
Cillian
Cillian 2012-8-31
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
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?
Cillian
Cillian 2012-9-1
I know there is no output, but I am supposed to create just one m.file consisting of these three functions.
I am looking for the code to be displayed in the output. For some reason, the code is not displayed.

请先登录,再进行评论。

采纳的回答

per isakson
per isakson 2012-9-1
编辑:per isakson 2012-9-1
You have provided three main functions
  1. forwardEuler
  2. backwardEuler
  3. 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
Walter Roberson 2012-9-4
Could you outline the solution for others that might encounter this problem?
per isakson
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 CenterFile Exchange 中查找有关 Just for fun 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by