Code covered by the BSD License  

Highlights from
Mining Economics with MATLAB

image thumbnail

Mining Economics with MATLAB

by

 

03 Dec 2012 (Updated )

Simulates a distribution of Net Present Values of a mine via a forecasting model for Iron Ore Prices

importirondb.m
%Set preferences with setdbprefs.
setdbprefs('DataReturnFormat', 'structure');
setdbprefs('NullNumberRead', 'NaN');
setdbprefs('NullStringRead', 'null');


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

%Read data from database.
curs = exec(conn, ['SELECT 	ironore.Month'...
    ' ,	ironore.Price'...
    ' ,	ironore.Change'...
    ' FROM 	ironore ']);

curs = fetch(curs);
close(curs);

%Assign data to output variable
data = curs.Data;

%Close database connection.
close(conn);

%Clear variables
clear curs conn

Contact us