MATLAB Answers

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

3 views (last 30 days)
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

ceethal piyus
ceethal piyus on 24 Oct 2017
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.

Accepted Answer

Sean de Wolski
Sean de Wolski on 24 Oct 2017
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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!