Logger

A container utility class to log values of various variables and messages from MATLAB code.

Al momento, stai seguendo questo contributo

A MATLAB class to create objects that can be used to log various events during the execution of a MALTAB script/function. This class is mainly a container, with some additional functionality built in to operate on the stored data in generating plots, applying functions etc.

The main aim of this class is to consolidate and store all the outputs and messages from a MATLAB script/function into a single object. These objects can be saved, and retrieved later, with all the information in one place Several utility functions (mainly for plotting) make it easy to operate on the stored data.

There are several ways in which you can use this class. You can either
(1) create a logger object, and start logging into the object
(2) user's class can be inherited from logger
(3) a global/persistent logger object can be created to log from various functions
(4) you can use matlab's event framework to log events by adding appropriate listeners.

Simple Example usage:

l = logger;

for i = 1:100,
my_output_1 = 10*rand;
height = 1.5*my_output_1 + 5*rand;

l.logVal('weight', my_output_1);
l.logIt(height);
end

l.setDesc('weight','Weight of Subjects');
l.setDesc('height','Height of Subjects');
l.setDefaultDesc('Subject ID');

figure; l.plot2Vars('weight','height','LineWidth', 2, 'Color','r');
figure; l.plotVar('weight','LineWidth', 2, 'Color','r');
figure; l.plotVar('height','LineWidth', 2, 'Color','r');
figure; l.plotFofVar('height',@log, 'LineWidth', 2, 'Color','r');

Also see logger_demo.m for example usage.
Documentation in HTML format is included. It is automatically generated using Doxygen for MALTAB.

Cita come

Pavan Mallapragada (2026). Logger (https://it.mathworks.com/matlabcentral/fileexchange/33099-logger), MATLAB Central File Exchange. Recuperato .

Categorie

Scopri di più su Software Development in Help Center e MATLAB Answers

Informazioni generali

Compatibilità della release di MATLAB

  • Compatibile con qualsiasi release

Compatibilità della piattaforma

  • Windows
  • macOS
  • Linux
Versione Pubblicato Note della release Action
1.1.0.0

Removed many documentation files that are useless, and retained only the class description.

1.0.0.0