Word Matlab Notebook and figures...

조회 수: 1 (최근 30일)
dpb
dpb 2014년 10월 19일
댓글: dpb 2014년 10월 20일
Have a script generating several figures -- may be 10 or more eventually.
Need to use these in a Word document for distribution so thought the notebook thingie would be pretty simple--just execute the script and voila! the figures should show up (or so I thought, anyways).
Instead the script runs, I see the figures flash by, but all that's left in the document is the last one; none of the rest are to be found anywhere.
Is this expected; if not how to cure the symptom in R2012b or if is a limitation, is there some other quick 'n dirty way to accomplish the job?

채택된 답변

Bruno Pop-Stefanov
Bruno Pop-Stefanov 2014년 10월 20일
편집: Bruno Pop-Stefanov 2014년 10월 20일
I tried on my end and it looks like you can only show one figure per cell. Instead of defining 1 cell containing all of your code, define multiple cells: one cell per figure.
This doesn't work:
[for i=1:5
figure(i)
plot(rand(10))
title(['Figure ' num2str(i)])
pause(1)
end]
(only figure 5 is displayed)
All five figures pop up, but only the last one remains open and is displayed in the MATLAB Notebook.
But this could be a workaround:
[figure(1)
plot(rand(10))
title('Figure 1')]
(figure 1 is displayed)
[figure(2)
plot(rand(10))
title('Figure 2')]
(figure 2 is displayed)
...and so on.
You could also take a look at the publish function, which lets you create HTML, PDF, XML, Microsoft Word, Microsoft PowerPoint, and LaTeX documents from MATLAB code:
In my opinion, this is more practical than using a MATLAB Notebook.
  댓글 수: 1
dpb
dpb 2014년 10월 20일
Yeah, probably so but that also seems to take more work on the coding side than what was hoping for.
Thanks for confirming behavior...
I just reverted to writing the text in a Word document and inserting the figures manually with a link to the files so that they do get updated if make a change in the generating code. That'll have to do for now, but thanks -- went ahead and accepted as you did answer the actual question that the notebook doesn't behave as I'd've liked it to in this instance of expanding the output cell automagically.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by