MATLAB Answers

Error when Generating a Script from the Import Tool

4 views (last 30 days)
I am trying to use the import tool to import various file formats. I can do the import successfully, but when I go to generate a script of the import (or live script or function)
I get the following error:
"Import operation failed. The most likely reason is that there are unimportable cells in the selection. ..."
This is true even if I use a file that is in the demo for the Import Tool documentation:
My colleague running the same version (MATLAB R2019a) is able to successfully import and generate the import script.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Apr 2020
For issues like these with example models, check if any files are shadowing build-in MATLAB functions.
In this case, a user-defined "strjoin" function from the MATLAB file exchange was shadowing MATLAB's built-in function of the same name. This caused the errors in the Import tool's "Generate Script" functionality, since it relies on MATLAB's built-in "strjoin" to properly execute.
The solution to avoid shadowing MATLAB's builtin functions is to restore the default MATLAB search path. 1) Before modifying the search path, you can take a backup of your 'pathdef.m' file, which can be located by using the command
>> which -all pathdef
Before proceeding, you should backup this file by copying it to a folder outside of your MATLAB path.
2) After making the backup, please execute the following commands in the MATLAB Command Window to restore the default MATLAB search path:
>> restoredefaultpath
>> rehash toolboxcache
3) After this step, try generating the import script again. If the issue is resolved, then you can save the new MATLAB search path by executing the following command:
>> savepath

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2019a

Translated by