3
$\begingroup$

Take this code :

    nomFichier = 
  "C:\\Users\\Me\\Dropbox\\testFile.wdx";

<<  nomFichier;
<<  "C:\\Users\\Me\\Dropbox\\testFile.wdx";

The first line works whereas the second one doesn't : why ?

The error is :

Get::noopen: Cannot open nomFichier.
$\endgroup$
0

1 Answer 1

5
$\begingroup$

According to the documentation:

<<"name" is equivalent to <<name. The double quotes can be omitted if 
the name is of the form specified in "Operator Input Forms".

So, << treats the literal expression as a file name.

Get[expression]

works, but the << form even ignores Evaluate.

$\endgroup$
2
  • $\begingroup$ In fact I read it also but how to tell to mathematica use the value of the variable and not its name. Is it possible ? $\endgroup$
    – StarBucK
    Jul 17, 2017 at 23:02
  • 1
    $\begingroup$ @StarBucK See edit. $\endgroup$
    – John Doty
    Jul 17, 2017 at 23:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.