Someone, please help me...I'm working on an EEG classifier based project for that this Classification Learner Toolbox will be a great help, but I got stuck in the very beginning...
I was working on Matlab R2015a's Classification Learner Toolbox. I successfully imported the file data and export it using Export Model, and i got a structure named trainedClassifier. But while running its showing the following error
2 ビュー (過去 30 日間)
古いコメントを表示
Ceethal Kottakali Piyus
2017 年 10 月 20 日
回答済み: Roya Salehzadeh
2022 年 11 月 7 日
matlab code clc; clear all; close all; a= readtable('input.csv'); height = [167; 152; 150; 159; 275; 285; 200; 253]; T =height; yfit = predict(trainedClassifier, T{:,trainedClassifier.PredictorNames})
error Undefined function or variable 'trainedClassifier'.
Error in check (line 7) yfit = predict(trainedClassifier, T{:,trainedClassifier.PredictorNames})
採用された回答
Sean de Wolski
2017 年 10 月 24 日
trainedClassifier is not in your workspace because you have a clear all at the beginning of the script which is clearing it.
I would recommend saving it after exporting and then loading in the script
Export from app.
save trainedClassifier.mat trainedClassifier
In script
load trainedClassifier.mat
predict(etc...)
その他の回答 (1 件)
Roya Salehzadeh
2022 年 11 月 7 日
Hi,
I have trained a classifier in MATLAB 2022 and saved it. I need to load the trained classifier inside a matlab function in Simulink (non in an m.file ) in MATLAB 2015a, and then use predict() fucntion. . Do you have any idea on how I should do that?
These commands work fine for the MATLAB 2022, when I use them inside the matlab function of Simulink block but they are not available for MATLAB 2015a:
- saveLearnerForCoder()
- loadLearnerForCoder()
For MATLAb 2015a, I tried to save the classifier in MATLAB 2022a as a mat file and then load the matin MATLAB 205a file and use predict function. It works when use these commands in command window or m.file, but When I use these inside the simulink matlab function I recieve an error.
function label = svmIonospherePredict(XTest) %#codegen
load('MdlLinear.mat'); %%% this loads an object
[label] = predict(MdlLinear,XTest);
end
- The output of a call to 'load' is not assigned to a variable. Assign its output to a variable without subscripting.
- Undefined function or variable 'MdlLinear'.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Classification Learner App についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!