Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 使用Plink执行包含单引号的命令时出现问题_Matlab_Batch File_Cmd_Plink - Fatal编程技术网

Matlab 使用Plink执行包含单引号的命令时出现问题

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

我正在使用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 ****** "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”
    
    并将文件(
    command.txt
    )与Plink一起使用,如:

    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
    开关)


感谢@martin的编辑。感谢100000000000的力量!我使用了您的第二个解决方案,使用了-T开关。