MATLAB Answers

Library Compiler Tool Matlab Code To Java Code Load Function Problem

3 views (last 30 days)
Volkan Ulutas
Volkan Ulutas on 1 Apr 2018
Commented: kenan atakan on 21 Jun 2018
Hello,
I exported Matlab code to Java as a java lib. I use Matlab Library Compiler toolbox. I do succcesfully but when I call from Java this library, I got th following error in the Matlab.
Mdl.mat (varible name Mdl_subdisc) added in "Files required for your library to run" in Matlab Library Compiler toolbox.
Can you help me about error? Thanks in advance.
.m file:
function score = HUClassificationV11(Data_Set)
Mdl_subdisc = classreg.learning.classif.ClassificationEnsemble.empty;
% ensembleSubspaceDisciriminant data_set is merged contains all data
% taken from HU PT
try
success ='model file is found'
load('Mdl.mat'); **%%%%%%%LINE 8 %%%%%%**
catch
error = 'model file is not found'
end
Data_Set = array2table(Data_Set);
% Convert to generic Data_Set annotation
for i = 1:1200
Data_Set.Properties.VariableNames{i} = strcat('Data_Set', num2str(i));
end
[labels, score] = predict(Mdl_subdisc, Data_Set) **%%%%%LINE 18 %%%%%**
Complete error: in JAVA
Warning: Cannot load an object of class 'CompactClassificationDiscriminant':
Its class cannot be found.
> In HUClassificationV11 *(line 8)*
Struct contents reference from a non-struct array object.
Error in classreg.learning.ensemble.CompactEnsemble.predictOneWithCache (line 258)
Error in classreg.learning.ensemble.CompactEnsemble.aggregatePredict (line 181)
Error in classreg.learning.classif.CompactClassificationEnsemble/score (line 81)
Error in classreg.learning.classif.CompactClassificationEnsemble/predict (line 145)
Error in HUClassificationV11 *(line 18)*
Error is occured. Detail: Struct contents reference from a non-struct array object.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by