MATLAB: Can someone tell me how to include line numbers when publishing m-file to doc

MATLABpublish m-code with line number

Hi I try to publish my m-code to a doc file. I would like to include line number in the doc file. Can someone tell me how to do it? Many thanks. Chen

Best Answer

One way is to do
>>dbtype yourFile.m
and copy/paste the results to your .doc file.