Can't open created PDF
显示 更早的评论
I'm making a program in GUIDE that creates regressions based off given data and plots them. For each plot, a log is created that details the type of plot, its form/constants, and MSE. I was able to successfully do this using a .txt and the following code. A button is pressed to begin the file, using the code
fid = fopen('Logfile.txt','w');
fid = fclose(fid);
Then, each time a regression is made, the following function is called:
function [ ] = logger( message, fileName )
fileID = fopen(fileName,'a');
fprintf(fileID,message);
fclose(fileID);
end
Where each message is a variable made previously and appended to the file. I also intend to save each figure, which brings me to my point. When replacing .txt with .pdf everywhere in the code, I am able to make the .pdf file, but it says damaged and I can't open it. Furthermore, I'm not sure how to save the plot in the GUIDE window to a PDF or how to append a PDF as well. Thanks for the help
EDIT: I am now aware that the procedure for appending .txt files does not apply to PDFs. I'm still looking for a way to compile the figures, and then combine it with the .txt to make a .pdf
2 个评论
Walter Roberson
2018-4-23
Do I understand correctly that you are attempting to create a .pdf file by simply changing the file extension .txt to .pdf, and otherwise leaving the code the same? Because that would definitely not work.
Reed Torres Torres
2018-4-23
编辑:Reed Torres Torres
2018-4-23
回答(1 个)
Walter Roberson
2018-4-23
0 个投票
Consider using the Report Generator, which is able to create PDF documents. You are able to add text to paragraph objects https://www.mathworks.com/help/rptgen/ug/mlreportgen.dom.paragraph.append.html
3 个评论
Reed Torres Torres
2018-4-23
Walter Roberson
2018-4-23
https://www.mathworks.com/help/matlab/matlab_prog/publishing-matlab-code.html
publish() perhaps
Walter Roberson
2018-4-23
https://www.mathworks.com/matlabcentral/answers/103861-how-can-i-save-a-word-document-as-a-pdf-via-actxserver-in-matlab-8-2-r2013b
On Windows you can use activex to talk to Word. The interface is enough include images and plots and arbitrary text. Word can be instructed to create a pdf.
类别
在 帮助中心 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!