.txt to .pdf using matlab

Hello Everyone,
As a part of an application, I am reading my pdf file and converting them to binary:
fileID = fopen(filename); A = fread(fileID,'*char')'; fclose(fileID);
bin_text = de2bi(double(A)); % convert to binary
I modulate and demodulate this data and convert back to characters:
demod_data = char(bi2de(demod_re))';
fileID = fopen('Received_Data.txt','wt');
fprintf(fileID,'%s',demod_data); fclose(fileID);
which I was able to implement, the problem now is to convert back to a proper PDF to verify with the original.
Can anyone help me with this ?

4 个评论

It isn't really an answer to your question, but you can call LaTeX from Matlab with the system command to compile a .tex file. So you would need to write a small .tex file that include Received_Data.txt. That way you can convert it to a .pdf.
Thanks for the suggestion Rik. I appreciate that! I have never really used the LaTex from MATLAB before, can you direct me to any document or any sample workflow. I really want to try this out, as I don't see any other way for this issue.
Many Thanks, Mounika
If you have a LaTeX file ready, you can just use the lines below. If you have never worked with LaTeX before, I can help you with the very basics, but after that there are better forums to ask help for LaTeX.
system('pdflatex -interaction=nonstopmode "your_tex_file_name.tex"')
system('bibtex "your_tex_file_name"')
system('pdflatex -interaction=nonstopmode "your_tex_file_name.tex"')
system('pdflatex -interaction=nonstopmode "your_tex_file_name.tex"')
The double quotes are only relevant if you're going to supply a file with a path that includes spaces (so C:\ProgFiles\a.tex or "C:\Program Files\a.tex").
That helps a lot to start with! Thank you so much Rik, will try this now

请先登录,再进行评论。

回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Environment and Settings 的更多信息

提问:

2018-2-13

评论:

2018-2-13

Community Treasure Hunt

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

Start Hunting!

Translated by