How can I take a screenshot of a certain amount of code lines?
37 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Supposing my code was this
% hello
% it's me
% I'm batman
a = 1;
b = 2;
% hello world
% don't know what else to write
how can I take a screenshot of the lines from 3 to 5 for example? If this was possible it would be handy for writing documents where code needs to be shown.
2 commentaires
John D'Errico
le 22 Jan 2019
Why do you think you need a screenshot? Code is text based. Text copies and pastes VERY easily. It takes less space to store than an image. It is editable. You can set fonts, colors, etc.
Just stick with text.
Réponses (1)
Steven Lord
le 22 Jan 2019
Consider writing your code in the Live Editor. Documents in the Live Editor can include both the code and the outputs from running that code in one report. The publishing functionality may be of interest if you want to send a document with code and outputs to someone who doesn't have MATLAB.
If you just want to display a subset of the lines in the file, you can use the dbtype function. That will display the lines as text rather than taking a screenshot of the Editor/Debugger section containing those lines, but perhaps that's sufficient for your needs.
Voir également
Catégories
En savoir plus sur Data Import and Export dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!