python调用matlab自己写的函数,如何在pythonscrip中调用自己的Matlab函数

本教程介绍如何在Matlab中使用MySQL。注意,您需要下载MySQL Connector/jjarhere(类似于mysql-connector-java-5.1.25-bin.jar)的文件。在% Database Server

host = 'mysql-user.stanford.edu';

% Database Username/Password

user = 'gfarmsharetest';

password = 'putyourpasswordhere';

% Database Name

dbName = 'g_farmshare_testing';

% JDBC Parameters

jdbcString = sprintf('jdbc:mysql://%s/%s', host, dbName);

jdbcDriver = 'com.mysql.jdbc.Driver';

% Set this to the path to your MySQL Connector/J JAR

javaaddpath('/usr/share/java/mysql-connector-java.jar')

% On Windows it looks like: javaaddpath('C:\server\mysql-connector-java-5.1.25\mysql-connector-java-5.1.25-bin.jar')

% Create the database connection object

dbConn = database(dbName, user , password, jdbcDriver, jdbcString);

% Check to make sure that we successfully connected

if isconnection(dbConn)

% Fetch the symbol, market cap, and last close for the 10 largest

% market cap ETFs

result = get(fetch(exec(dbConn, 'SELECT foo,bar from matlabfoo')), 'Data');

disp(result);

else

% If the connection failed, print the error message

disp(sprintf('Connection failed: %s', dbConn.Message));

end

要运行查询:

^{pr2}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值