Code covered by the BSD License  

Highlights from
Credit Risk Modeling with MATLAB

image thumbnail

Credit Risk Modeling with MATLAB


Ameya Deoras (view profile)


07 Jun 2010 (Updated )

These are the supporting MATLAB files for the MathWorks webinar of the same name.

% GETDBDATA: An automatically-generated MATLAB script for reading
% historical credit rating data from a database.

% Set preferences with setdbprefs.
s.DataReturnFormat = 'structure';
s.ErrorHandling = 'store';
s.NullNumberRead = 'NaN';
s.NullNumberWrite = 'NaN';
s.NullStringRead = 'null';
s.NullStringWrite = 'null';
s.JDBCDataSourceFile = '';
s.UseRegistryForSources = 'yes';
s.TempDirForRegistryOutput = 'C:\Temp';
s.DefaultRowPreFetch = '10000';

% Make connection to database.  Note that the password has been omitted.
% Using ODBC driver.
conn = database('Historical Credit Ratings','','password');

% Read data from database.
e = exec(conn,'SELECT ALL ID,WC_TA,RE_TA,EBIT_TA,MVE_BVTD,S_TA,Industry,Rating FROM Ratings');
e = fetch(e);

% Close database connection.

% Create a MATLAB structure from the returned data.
historicalData =;

clear conn e s

Contact us