'Dot indexing not supported' error shows up only when running executable

조회 수: 3 (최근 30일)
Hey,
I see this 'Dot indexing is not supported for variables of this type' error only when running an excutable created from a matlab script. I don't see such error when executing the matlab script itself.
I figured out this snippet here was causing the error. When I comment it out in the matlab script and create an executable, the executable runs fine.
Please, help with this error. Thanks. Also, I use MATLAB 2020b.
  댓글 수: 6
Walter Roberson
Walter Roberson 2022년 3월 9일
Are you trying to train a model inside a .exe ? Most training functions cannot be compiled (some can be compiled.)
Sujit Tripathy
Sujit Tripathy 2022년 3월 9일
No. I am simply trying to extract model cofficients. Thanks.

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 2022년 3월 9일
Let me guess, you're calling load to load the LinearModel object from a MAT-file. Please see the Tip in the "Fixing Callback Problems: Missing Functions" section on this documentation page. When MATLAB Compiler analyzed your code to determine what needed to be included in the MCR, there was no indication in the code itself that it needed to include the definition of the LinearModel class in the application. Therefore it didn't, and when you called load the application didn't know how to turn the loaded data into an instance of the object.
If you use the -a argument or the %#function pragma to tell MATLAB Compiler that it needs to include the class definition in the application, when you load the object from the MAT-file the application will know the "recipe" for turning that data back into an object.
  댓글 수: 4
Steven Lord
Steven Lord 2022년 3월 9일
If you created the LinearModel object using fitlm or stepwiselm as stated on the documentation page telling MATLAB to include that function in your application may be sufficient. I have not tried this, though.
%#function fitlm
%#function stepwiselm
Or you may be able to just include the class definition using its name.
%#function LinearModel

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Model Building and Assessment에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by