MATLAB Answers

0

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

Asked by ceethal piyus on 20 Oct 2017
Latest activity Commented on by ceethal piyus on 25 Oct 2017
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})

  1 Comment

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...

Sign in to comment.

1 Answer

Answer by Sean de Wolski
on 24 Oct 2017
 Accepted Answer

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 Comment

Sign in to comment.