I have a number of notebooks -295 precisely- in a folder. Each notebook contains one or more large matrices. What is the proper way of importing each one of these notebooks in a new notebook for manipulations?

I tried

Import["Name of desired notebook", 
"path of the notebook"]

And it does not work. I am getting the following error message:

"Import: File not found during import"

For the path of the notebook I just copy the exact result after I do command+i -I am working on a mac.

Can someone explain to me what is going wrong?

  • 1
    $\begingroup$ Can you change the .nb files to something else, like package files (.wl/.m) or .mx files? Because notebook files are really not designed to be imported into other files... If you need to use .nb files, look at the documentation of Import, your syntax is currently wrong. You can also look at the documentation of the NB file format - you could mark the cells with the matrices as initialization cells and import the "Initialization" import element. $\endgroup$ – Lukas Lang Sep 17 at 11:09
  • $\begingroup$ Thanks. I will try your suggestions. $\endgroup$ – A_user_with_NoName Sep 17 at 11:13
  • $\begingroup$ Since each notebook contains a matrix, why not evaluate all the notebooks, i.e., use NotebookEvaluate (instead of importing). That way the current session will have the data associated with all the notebooks. $\endgroup$ – bill s Sep 17 at 16:42
  • $\begingroup$ Try NotebookEvaluate[<file_name>, InsertResults -> False]. $\endgroup$ – Rohit Namjoshi Sep 17 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.