2
$\begingroup$

I've been having a strange problem with Module. Oddly it seems to be linked to my use of Import and then applying a function such as Flatten to my Import. I pasted images of my code and output because there also seems to be an issues with regard to the cells that the code is in. I'm using 64 bit version 10.0.1.0.

enter image description here

Now I apply Flatten to inputData:

enter image description here

Oddly, if I put the statement inputData in the first cell, then everything works.

enter image description here

If I go back to my second set of code, but remove the Module, then again everything works.

enter image description here

The spreadsheet is just 4 rows, as you see in the output. This is simplified from the actual problem I'm working on. It seems that Mathematica is not making the assignment to inputData, but rather somehow keeping it linked to the Import statement until the end of the Module.

$\endgroup$
14
  • $\begingroup$ Really weird. This behavior doesn't exist if you input the entire file path into the Import function (C:\\Users\\username\\test1.xlsx). $\endgroup$
    – kale
    Commented Oct 13, 2014 at 17:45
  • 1
    $\begingroup$ Could you please insert FullForm@inputData before the Flatten? $\endgroup$ Commented Oct 13, 2014 at 17:47
  • $\begingroup$ @kale I tried that in my full version and sometimes it worked and other times it didn't. But that was getting so complicated that I can't be sure that I repeated my steps accurately. $\endgroup$ Commented Oct 13, 2014 at 17:49
  • $\begingroup$ Even weirder, if you place Trace around the x = Flatten[inputData];, all values seem to be assigned correctly. Otherwise x still equals Flatten[$Failed]. $\endgroup$
    – kale
    Commented Oct 13, 2014 at 17:50
  • 1
    $\begingroup$ If you have the Suggestions Bar turned on, does it make any difference if you turn it off? There have been reports of the Suggestions Bar mangling output. $\endgroup$
    – WReach
    Commented Oct 14, 2014 at 16:31

1 Answer 1

3
$\begingroup$

There have been reports in version 10.0.1 that the Suggestions Bar (aka Predictive Interface) sometimes mangles output values in notebooks. Try turning off the Suggestions Bar as described in this Wolfram Support Article.

Preferences dialog screenshot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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