5.0

5.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 71.1 KB File ID: #33099
image thumbnail

Logger

by Pavan Mallapragada

 

01 Oct 2011 (Updated 03 Oct 2011)

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

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File  
Everyone's Tags
container, doxygen, log, logger, logging, oop
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
12 Feb 2012 Jurek Dziewierz

Great! does exactly what i needed (after a small modification)

Updates
03 Oct 2011

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

Contact us