matlab and access

  • Follow


Is access of access databases part of the basic matlab capability?  I tried to open a database with the database command, and Matlab did not recognize this?  Could it be because access was not installed on the computer?  Or do I need an additional matlab software component?
0
Reply Sharon 12/30/2009 11:30:07 AM

"Sharon Lindenbaum" <sharon.L@elbitsystems.com> wrote in message <hhfdju$abc$1@fred.mathworks.com>...
> Is access of access databases part of the basic matlab capability?  I tried to open a database with the database command, and Matlab did not recognize this?  Could it be because access was not installed on the computer?  Or do I need an additional matlab software component?

Hi Sharon

I use Access as a database in connection with matlab. Try to write "ver" in your command window. You need the "DATABASE TOOLBOX" to import and export data to a database. If you do not have any experience with the "Database TOOLBOX" I would recommend you to read about the functions exec, update and insert. 

You also have to setup an access database, but it is very easy and can be read in the documentation.

Best Regards

Hans 
0
Reply Hans 12/30/2009 11:56:03 AM


"Sharon Lindenbaum" <sharon.L@elbitsystems.com> wrote in message <hhfdju$abc$1@fred.mathworks.com>...
> Is access of access databases part of the basic matlab capability?  I tried to open a database with the database command, and Matlab did not recognize this?  Could it be because access was not installed on the computer?  Or do I need an additional matlab software component?

It is possible to connect to the database without going through the database toolbox, using ADODB objects.  You will have to have Access installed on your computer so the database engine is available to you (so I am not sure if this solution would work on Linux or Mac).

Some example code:

conn = actxserver('ADODB.Connection');
% The connection string below may vary for you...Google 'ms access connection
% string' for examples that may be more pertinent for your use.
conn.Open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;')

% Run a query using the 'Execute' command.  If it is expected to return results
% (i.e. a % SELECT statement), use 'GetRows' to see your data.
sqlQuery = 'select myData from myTable'
data = conn.Execute(sqlQuery).GetRows' % Note transpose.  'data' is usually a cell array.
0
Reply Michael 12/30/2009 1:53:04 PM

2 Replies
301 Views

(page loaded in 0.129 seconds)

Similiar Articles:













7/24/2012 1:22:10 AM


Reply: