Reputation: 41
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,
Upvotes: 1
Views: 250
Reputation: 202310
It's not Plink fault. It's how Windows command-line interpreter works.
Adding cmd and batch-file tags, so that you may get answers from experts on the field.
Anyway, I can see two solutions:
Put your command to a file like:
matlab -nodesktop -nosplash -noawt -r "try, someFunction('path/to/files', 'algorithm'), exit(); catch ME, warning(ME.message), exit(); end"
And use the file (command.txt
) with Plink like:
C:\plink.exe user@server -pw ****** -m command.txt
If you do not want to use a separate file for the command, this should work too:
echo matlab -nodesktop -nosplash -noawt -r "try, someFunction('path/to/files', 'algorithm'), exit(); catch ME, warning(ME.message), exit(); end" | C:\plink.exe user@server -pw ****** -T
(Note the -T
switch).
Upvotes: 1