【发布时间】:2015-09-15 06:00:36
【问题描述】:
我能够在 Win 7 机器上将字符串(路径)参数从 python 传递给 matlab 脚本(并且脚本在 新的 matlab 命令窗口中成功运行):
matlab_cmd_string = MatlabExePth+ " -nosplash -nodesktop -wait -logfile FileIoReg_MatlabRemoteRun.log -minimize -r "
mat_file = "tst_script"
tstPth = 'C\\SVN\\Matlabcode\\tst1'
mat_cmd = matlab_cmd_string + "\"" + mat_file + "("+ "\'" + tstPth + "\'" + ")" + ", exit\""
所以上面的计算结果为
"C:\Program Files\MATLAB\R2013b\bin\matlab.exe" -nosplash -nodesktop -wait -logfile FileIoReg_MatlabRemoteRun.log -minimize -r "tst_script('C\SVN\Matlabcode\tst1'), exit"
但是,现在,我需要传递一个 List(它成为 matlab 单元数组)作为参数,以便将 Matlab 称为
tst_script1(Python_list)
然而,在 python 中应该作为参数传递的是列表值, 而不是像
"C:\Program Files\MATLAB\R2013b\bin\matlab.exe" -nosplash -nodesktop -wait -logfile FileIoReg_MatlabRemoteRun.log -minimize -r "tst_script1('Python_list'), exit"
其中Python_list被当作一个字符串。
我该怎么做?
赛迪
【问题讨论】:
标签: python