Unexpected MATLAB operator when using fully qualified path name

I'd like to specify a fully qualified path name as input to Matlab on Linux, but it doesn't seem to accept it. The file is
% cat hw.m
msg='hello, world'
From the Matlab prompt, anything other than the basename causes an error. Is there a way to make this work?
>> /home/matlab/hw
/home/matlab/hw
|
Error: Unexpected MATLAB operator.
>> ~/matlab/hw
~/matlab/hw
|
Error: Unexpected MATLAB operator.
>> ./hw
./hw
|
Error: Unexpected MATLAB operator.
>> hw
msg =
hello, world

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 23 Jul. 2015
Bearbeitet: Azzi Abdelmalek am 23 Jul. 2015
You have forgotten the quotes
'/home/matlab/hw'

1 Kommentar

Thanks, that works from the Matlab prompt. It looks like I have to escape it from the command line:
% matlab -nodisplay -nosplash -r \'/home/matlab/hw\'

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by