MATLAB export Live Script as pdf with line numbers displayed? - matlab

I have a MATLAB Live Script (.mlx) that I am exporting to a pdf in order to print/share. I have the line numbers displayed in the script while working with it in the live editor, but when I export the script to a pdf, the line numbers are gone.
Is there a way to make the line numbers display in the pdf output as well?
To be clear, I have already enabled line numbers using the 'View' tab in MATLAB. It is the pdf output that I am trying to get the line numbers to display in.
Thank you!

Related

Importing graphic data into text file MATLAB

I am trying to create a program in MATLAB by which I can click on an image (using the input command) and MATLAB outputs a graphic marker on the image, and stores the data to a text file.
The motivation for this comes the Major League Baseball Gameday App, as I want to use it for a similar purpose, but on the input rather than the receiving end. I have created a code which takes an image and outputs a graphic marker at the points clicked. However, I need to improve the code by (hopefully) color coding each marker according to a manual input (maybe using the reply function?) and also numbering each marker. Also, I would like it to output the reply, location, and number to a text file which can be saved for later.
The code I have is below (with comments explaining what is missing), any help is appreciated.
img=imread('Path/Filename.png');
image(img);
title('Pitching')
ginput
%ask for reply of text between each click
M=[ans];
N=length(M);
hold on
for i=1:N
plot(M(i,1),M(i,2),'o','MarkerFaceColor','r','MarkerSize',25);
%make FaceColor coded according to reply from click
%number each click
%write data to text file
end

How to display multilines output in a line (Horizontal view) in Matlab?

I have made an program that can display many outputs in same textbox in matlab.
The main program do looping and the GUI catch the output and display the outputs in same textbox. But the problem is that the output is displayed in new line.
Iwan to display the output just in one line..
How to do it?
Here is my Gcode to display the output in the GUI.
letterr = ProcessOutput;
set(handles.text4,'String',letterr);
you can use
set(handles.text4,'String',strjoin(letterr));
depending on the version of matlab you are using, this function is implemented or not. If not, you can get it from here:
File-exchange: strjoin

How a save figure as an eps file with Chinese characters inside in matlab

I'm using Windows XP (simplified Chinese version), matlab 2011b.
I can draw my figure successfully using matlab with Chinese chars in labels, legends, titles, etc. And it can be saved to bitmap files just well. But When I save the figure into eps file, the character become garbled.
I know I can edit the saved eps file to get it right,but is there a way to successfully save such figures as eps? A Linux solution is also OK for me.

Add text to PDF

I've got an exported version of a MATLAB diagram, similar to the one below. The problem is, that there are no axis captions. It's not possible to export the file again from MATLAB. I need to edit the PDF programmatically and edit about 100 diagrams, all with the same axis positions.
Is there a clean and fast way to paste the Strings X and Y at the corresponding positions in the pdf based on a batch process?
Create a PDF file with the captions. Add that as a background with to the PDF files with pdftk.
if know how to use LaTeX, the pstool package can bring you far on this on, including replacing labels (or actually any text on an eps figure) with TeX symbolic expressions. Neat if you're already working in LaTeX.

How can I print out a large table of symbols from MATLAB to form a cross-stitch chart?

On this website, one can create stitch charts from images. I'm trying to do this in MATLAB. I have implemented everything using the Image Processing Toolbox (Reducing of number of the colors, mapping to the color space of available yarn colors). I'm done with all of this, the only thing I still need to do is to create an output similar to these files from MATLAB, which basically show which yarn to use for each raster point of the stitch chart:
BW
Color
My question is how to print a table with a lot of very small fields with the color and/or symbol inside.
It should look somehow like in these PDF files. How can I print out a table like this? Directly from MATLAB? Can I create a PDF file like this in MATLAB? Should I export it to Excel somehow?
For the "color" PDF you linked, this looks just like a pixelated image. Why don't you save each "field" as one pixel, for example in a TIF file using imwrite(I, 'filename')? You could then print this TIF into a PDF using an appropriate scaling factor to make the pixels large enough.
For the "BW" PDF which basically contains a large table of symbols, it would probably be easiest to go through HTML or RTF file format to get the table of symbols, and then use some html2pdf or rtf2pdf converter...