Import Data - Generate Script/Function Error
古いコメントを表示
I'm in the process of creating a new model but have been having issues with the "Generate Script" and "Generate Function" options from Import Data (See picture).
The data is saved in an excel file that gets edited occasionally.
I've gotten the same error with all the Output Types, and it only works when I select the importing button directly (not as a script or function, which I need in order to use the model)
I noticed the issue with my attached file, however I've also tried fillling out the empty cells and other excel files, as well as using a different computer (which was also running v 2019b), and no luck as of yet.
The error I am receiving is:
--------------------------------------
Import operation failed. The most likely reason is that there are unimportable cells in the selection.
Try adding a rule in the toolstrip to convert unimportable cells into numbers.
-------------------------------------
As you can see in the picture labeled ImportDataError.PNG, I already have a rule for dealing with the unimportable cells (I've also tried with blank cells and both).
I understand that there are other ways to import the data but I was told by a coworker that they do it this way and prefer me to do it the same way, for consistency.
Is anyone else having this issue/has anyone found a solution?
Thank you for your help!
1 件のコメント
Azhar iqbal
2020 年 1 月 1 日
Matlab Version is issue
回答 (1 件)
Subhadeep Koley
2019 年 11 月 8 日
編集済み: Subhadeep Koley
2019 年 11 月 8 日
0 投票
Hi, it is giving no such errors when I am trying to do the same with your Com_SampleProjects.xlsx file. Can I know which MATLAB version you are using?
However, generated the script and the function in my end (see the attached), which you can use.
Hope this helps!
5 件のコメント
Joaquin Pinto
2019 年 11 月 11 日
編集済み: Joaquin Pinto
2019 年 11 月 11 日
Subhadeep Koley
2019 年 11 月 11 日
Hi Joaquin, I tried to reproduce the same steps as you mentioned but in that case also I am not facing the "Import operation failed" error.
One workaround might be to keep your excel file in the Documents folder and adding the following line at the begining of the importFileScript.m file while calling it from the 'C:/matlab' path.
docPath = 'yourDocumentFolderPath'; % Paste the full path of your Documents folder here
addpath(docPath);
Hope this helps!
Joaquin Pinto
2019 年 11 月 11 日
Subhadeep Koley
2019 年 11 月 11 日
Hi Joaquin, it seems that you don't have the write permission in the file path 'C:/matlab', as you stated that "It doesn't even allow me to create the function when doing it from there..."
Joaquin Pinto
2019 年 11 月 11 日
編集済み: Joaquin Pinto
2019 年 11 月 11 日
カテゴリ
ヘルプ センター および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!