Error when Generating a Script from the Import Tool
5 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2020-4-7
回答: MathWorks Support Team
2020-4-7
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.
采纳的回答
MathWorks Support Team
2020-4-7
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!