python - 如何使用字符串作为输入从 Matlab 调用 Matlab 函数
问题描述
我想my_function(string1,string2)
从 Python 运行一个自写的 Matlab 函数,我尝试使用这个命令:
!matlab -nosplash -r my_function(string1,string2)
当我给两个特定的字符串作为输入变量时,这有效
!matlab -nosplash -r my_function('myfirststring','mysecondstring')
,但是当我给两个字符串变量时它不起作用:
string1='myfirststring'
string2='mysecondstring'
!matlab -nosplash -r my_function(string1,string2)
Matlab 给出错误信息:
Undefined function or variable 'string1'.
如何将实际字符串提供给 Matlab 函数而不是变量名?
解决方案
推荐阅读
- dialogflow-es - agent.add(conv) 在 dialogflow-fulfillment-library 中不起作用?
- swift - 为什么这个函数没有返回任何东西?
- php - 如何在同一页面中使用 html 和 php 在下拉的选择更改事件的输入字段中从数据库中获取选定的数据
- arrays - 使用 mongodb 的 java 驱动程序从集合中获取数组字段
- c# - .Net Core 2 OpenID Connect 身份验证和多个身份
- google-cloud-platform - Apache Beam python sdk 因 IllegalArgumentException 而失败
- google-drive-api - 使用 Drive API 使用 Word 打开 Google Drive 文件
- yii2-advanced-app - 例外:LINUX下的Unknown Property,但在使用kartik widget CheckBoxX的Windows下没有
- swift - 尝试将图像上传到 Firebase 存储和数据库时出现问题?
- php - 检查 SSL 证书 Php Fopen 和 Curl