Effacer les filtres
Effacer les filtres

Command Window Output to txt file

1 vue (au cours des 30 derniers jours)
Pedro Felipe Oliveira
Pedro Felipe Oliveira le 6 Sep 2015
How can I save the output data generated in command window in *.txt file? I tried to use the diary function, but I want one file for each program execution. Thanks in advance.

Réponse acceptée

Mohammad Abouali
Mohammad Abouali le 6 Sep 2015
You could instruct your code to force the diary into a separate file each time your code is executed. Something like this:
diary(sprintf('run_%s_%d.txt',datestr(now,'yyyy_mm_dd_HH_MM_SS'),randi([1,10000],1)))
depending on the time you are running your code a separate file is generated for example:
run_2015_09_06_16_27_47_8148.txt
the output would be stored in a file such as above. That changes everytime you run that code snippet.
  1 commentaire
Pedro Felipe Oliveira
Pedro Felipe Oliveira le 8 Sep 2015
It Works Sir Abouali. Thanks a lot!!

Connectez-vous pour commenter.

Plus de réponses (1)

ibenitoseb
ibenitoseb le 28 Mar 2019
This tutorial shows you how: https://www.youtube.com/watch?v=KF3xCpKhb_s&t=62s

Catégories

En savoir plus sur MATLAB Compiler 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!

Translated by