当前位置: 首页 > news >正文

手机版企业网站iis7站长工具

手机版企业网站,iis7站长工具,自己做网站需要什么技能,沈阳城乡建设局官网MATLAB与Python版本的兼容 具体可参看MATLAB与Python版本的兼容 操作说明 操作说明请参看下面两个链接: 操作指南 简单说明: 我安装的是MATLAB2022a和Python3.8.6(安装时请勾选所有可以勾选的,包括路径)。对应版本安…

MATLAB与Python版本的兼容

具体可参看MATLAB与Python版本的兼容

操作说明

操作说明请参看下面两个链接:

  1. 操作指南
    简单说明:
    我安装的是MATLAB2022a和Python3.8.6(安装时请勾选所有可以勾选的,包括路径)。对应版本安装完成后,在MATLAB命令行中敲入执行路劲’D:\SoftwareApps\Python3_7\python.exe’(因人而异)
pyenv('Version','D:\SoftwareApps\Python3_7\python.exe')

完了以后执行下面的操作:

pe = pyenv;
pe.Version

完成后的界面为:
在这里插入图片描述
因为MATLAB更多的是矩阵计算,我们需要安装两个库,一个是numpy,一个是scipy。具体地,我们可以在windows 的操作终端(cmd/terminal)输入python,进入到python可以执行的页面,执行以下命令:

import sys
import subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install','numpy'])
subprocess.check_call([sys.executable, '-m', 'pip', 'install','scipy'])

完成之后,我们即可开始测试

  1. 测试案例
    (1)MATLAB中的.m文件(call for Python)
% use this link to check if your MATLAB version supports the Python version
% on your computer
% https://www.mathworks.com/support/requirements/python-compatibility.html
% if not, install the Python version that is supportedclc;clear all;% define MATLAB matrices
A1=[1 2;3 4];
A2=[2 3;1 0];% check the conversion types
% https://www.mathworks.com/help/matlab/matlab_external/passing-data-to-python.html
% convert matrices to Python objects
A1converted = py.numpy.array(A1);
A2converted = py.numpy.array(A2);
% parameter to be sent
parameter=py.int(2);% sent the variables, call the python code in "test.py" and obtain the
% return list "result"
[result] = pyrunfile("haha.py","ReturnList",A=A1converted,B=A2converted,param1=parameter);
% link explaining pyrunfile() function:
% https://www.mathworks.com/help/matlab/ref/pyrunfile.html#mw_03ecec06-0677-4345-9112-ea93ac49881e% check the data type of returned variables
class(result)
class(result{1})% convert the Python arrays to MATLAB matrices
C1=double(result{1});
C2=double(result{2});
C3=double(result{3});
C4=double(result{4});% compute the matrices in MATLAB to double check the results
C1check=A1+A2;
C2check=A1*A2;
C3check=eye(2,2);
C4check=inv(A1);

(2)Python中的.py文件(called by MATLAB)

# -*- coding: utf-8 -*-
"""
Code that demonstrates how to run Python code from MATLAB
This is the Python code that is called from MATLAB
Author: Aleksandar Haber 
Date: December 2022The matrices "A" and "B" are passed to Python from MATLAB
The list "ReturnList" is returned to MATLAB"""# You should run these code lines in a separate Python session if the libraries numpy and scipy are not installed
# import sys
# import subprocess
# subprocess.check_call([sys.executable, '-m', 'pip', 'install','numpy'])
# subprocess.check_call([sys.executable, '-m', 'pip', 'install','scipy'])import numpy as np
from scipy import linalgC1 = A + B
C2 = np.matmul(A,B)
C3 = np.eye(param1,param1)
C4 = linalg.inv(A)# this list is returned to MATLAB and later on unpacked in MATLAB
ReturnList=[C1,C2,C3,C4]

具体到一些输入输出的语法,请参看链接:https://www.mathworks.com/help/matlab/ref/pyrunfile.html

参考

[1] https://www.mathworks.com/support/requirements/python-compatibility.html
[2] https://aleksandarhaber.com/tutorial-on-how-to-execute-python-code-directly-matlab/
[3] https://github.com/AleksandarHaber/Execute-Python-Code-From-MATLAB/blob/

http://www.ds6.com.cn/news/22830.html

相关文章:

  • 装修平台网站排名前十名做运营的具体做什么
  • 做货运代理网站典型的网络营销案例
  • 广州网络兼职网站建设网站推广技巧和方法
  • 湖南设计网站机构网站建设图片
  • 怎么做网站的需求武汉网络推广优化
  • 药物研发网站怎么做论坛如何做seo
  • 新乡专业做网站多少钱今天国际新闻最新消息10条
  • 自己建设的网站有管理后台的登录网络运营培训课程
  • 如何注销网站域名网站排名查询alexa
  • 用excel做网站日志分析厦门seo总部电话
  • 灰色系网站湘潭网站定制
  • 端午节网站怎么做微博指数查询入口
  • 成都网站设计很好网络视频营销
  • 北京行业网站建设windows优化大师要钱
  • 网站毕业设计图怎么做郑州seo排名哪有
  • 长春网架公司seo快速排名源码
  • 厦门 建网站关联词有哪些
  • 网站草图怎么做东莞网站建设seo
  • 网站开发与网站制作百度最贵关键词排名
  • 中国互联网协会成立外链seo服务
  • 一般网站建设公司怎么收费网页设计模板免费网站
  • 网站错误提示页设计seo站外推广有哪些
  • 电商网站的多选菜单插件山西seo优化公司
  • 海口哪里做网站免费b站推广短视频
  • 为什么我的电脑有些网站打不开业务推广平台
  • 蚌埠公司做网站抚顺seo
  • 我也来做外国网站购物360浏览器网页版入口
  • 做外贸学网站app推广联盟
  • 济南直销网站制作刷网站软件
  • 与建设部网站上海网站快速排名优化