How to write error information into a file
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jason
le 9 Mar 2016
Réponse apportée : Walter Roberson
le 9 Mar 2016
For the following code, if we catch a error, how do I do so that the error information('Inconsistent data in iteration %s, skipped.\n', i) can be write into a file(e.g.)? So after code finish running, I can open the file to check the error information.
for i=1:100
try
NonData=[Weight;Height;Age];
% do something with your NonData
catch
fprintf('Inconsistent data in iteration %s, skipped.\n', i);
end
end
0 commentaires
Réponse acceptée
Walter Roberson
le 9 Mar 2016
Consider diary()
Over the longer term, fopen a file and fprintf to the file identifier.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur String Parsing 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!