Issue in executing command containing single quote using Plink
2 次查看(过去 30 天)
显示 更早的评论
I am using plink.exe from cmd in Windows 10, to ssh to Ubuntu 16.04. In there, I am running MATLAB, to run the following command:
try, someFunction('path/to/files', 'algorithm'), exit(); catch ME, warning(ME.message), exit(); end
For this, I generate the following command to handle ssh, executing matlab and run the above command:
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'
Running the above command, I get the following error in MATLAB:
Warning: Undefined function or variable 'path/to/files'.
As it turns out, in MATLAB, the command is constructed like following:
someFunction(path/to/files, algorithm)
which is without "single quotes": thank you, plink :( .
Can you please help to generate the correct command? or if there is already a question asked with similar problem, I would be thankful to direct me to it.
Thanks,
0 个评论
采纳的回答
更多回答(1 个)
Fangjun Jiang
2018-8-20
编辑:Fangjun Jiang
2018-8-21
I would suggest putting all the commands in a M-script and then run
"fullpath\bin\matlab.exe" -r "MyScript"
Notice the double quote "
FYI, in matlab, the command is constructed like following:
someFunction('path/to/files', OtherInputArguments)
or
MyFile='path/to/files'
someFunction(MyFile, OtherInputArguments)
To create a single quote in a string, refer to the following example:
a='path/to/files'
b='''path/to/files'''
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!