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