Publish Problem in PDF

15 Ansichten (letzte 30 Tage)
Cillian
Cillian am 31 Aug. 2012
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 Kommentare
per isakson
per isakson am 1 Sep. 2012
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 am 1 Sep. 2012
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

per isakson
per isakson am 1 Sep. 2012
Bearbeitet: per isakson am 1 Sep. 2012
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 Kommentare
Walter Roberson
Walter Roberson am 4 Sep. 2012
Could you outline the solution for others that might encounter this problem?
per isakson
per isakson am 4 Sep. 2012
I haven't a clue what caused or solved the problem and our communication in Swedish doesn't even provide a hint.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Just for fun finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by