Matlab 使用Plink执行包含单引号的命令时出现问题
我正在使用Windows 10中的Matlab 使用Plink执行包含单引号的命令时出现问题,matlab,batch-file,cmd,plink,Matlab,Batch File,Cmd,Plink,我正在使用Windows 10中的cmd中的plink.exe,以ssh方式连接到Ubuntu 16.04。在这里,我运行MATLAB,运行以下命令: try, someFunction('path/to/files', 'algorithm'), exit(); catch ME, warning(ME.message), exit(); end 为此,我生成以下命令来处理ssh,执行matlab并运行上述命令: C:\plink.exe user@server -pw ****** "ma
cmd
中的plink.exe
,以ssh方式连接到Ubuntu 16.04。在这里,我运行MATLAB,运行以下命令:
try, someFunction('path/to/files', 'algorithm'), exit(); catch ME, warning(ME.message), exit(); end
为此,我生成以下命令来处理ssh,执行matlab并运行上述命令:
C:\plink.exe user@server -pw ****** "matlab -nodesktop -nosplash -noawt -r 'try, someFunction('path/to/files', 'algorithm'), exit(); catch ME, warning(ME.message), exit(); end'
运行上述命令,我在MATLAB中得到以下错误:
Warning: Undefined function or variable 'path/to/files'.
事实证明,在matlab中,命令的构造如下所示:
someFunction(path/to/files, algorithm)
没有“单引号”:谢谢你,普林克:(
你能帮我生成正确的命令吗?或者如果已经有类似的问题被问到了,我会很感激地告诉我
谢谢,这不是Plink的错。这是Windows命令行解释器的工作原理
添加和标记,以便您可以从该领域的专家那里获得答案
无论如何,我可以看到两种解决方案:
- 将命令放入如下文件:
并将文件(matlab-nodesktop-nosplash-noawt-r“try,someFunction('path/to/files','algorithm'),exit();catch ME,warning(ME.message),exit();end”
)与Plink一起使用,如:command.txt
C:\plink.exeuser@server-pw******-m command.txt
- 如果不想为命令使用单独的文件,这也应该可以:
(注意echo matlab-nodesktop-nosplash-noawt-r“try,someFunction('path/to/files','algorithm'),exit();catch ME,warning(ME.message),exit();end”| C:\plink.exeuser@server-pw******-T
开关)-T