필터 지우기
필터 지우기

Error: 'model' parameter must be a string."what should I do?!!!

조회 수: 5 (최근 30일)
Talal
Talal 2012년 1월 29일
답변: Rinku Kumar 2018년 10월 31일
Hello Everyone, I'm trying to reproduce some new data from a trained network and I'm getting this error: "??? Error using ==> forward_network at 12 'model' parameter must be a string." Please advise.
Thanks, TSM
[EDITED, copied from comments]
a = imread(filename);
b = rgb2gray(a);
glcmn1 = graycomatrix(b);
c = glcmn1 (:);
a = load ('Channel and Fault Recognition.mat');
sim (a, c);
I tried to load the neural network from folder and simulate it with the input "c", same error was occurred.
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 1월 30일
We need to see the call, and for any parameter passed in which is a variable, we need to know class() of that variable.

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

답변 (3개)

Rina Blomberg
Rina Blomberg 2015년 3월 15일
편집: Rina Blomberg 2015년 3월 15일
My answer may not be related to this specific problem, but it may help anyone searching for this particular error message when attempting to use the function sim() after having saved and loaded a trained neural network.
The trained network is saved as a .mat file. Eg:
save([path 'net.mat'], 'net');
If for example, this network is then loaded in another script:
net = load([path 'net.mat']);
and then one attempts the follwing code:
results = net(testdata); or results = sim(net, testdata);
Then MATLAB outputs the following error (respective to the function used above): Subscript indices must either be real positive integers or logicals or 'model' parameter must be a string
The reason for the error in this particular scenario is because the network has been saved in a struct array. To access the network for simulation you must write: importvariablename.savedvariablename. For example, if using the variable names from above the network must be properly accessed by writing:
results = net.net(testdata); or results = sim(net.net, testdata);

Rinku Kumar
Rinku Kumar 2018년 10월 31일
for the problem of error 'model' parameter must be a string....... sim command must include the quotes, for example
sim('Model name')
will consider the model parameter as a string...
very simple

Matt Fig
Matt Fig 2012년 11월 29일
From the help (which you can read too!):
SimOut = sim('MODEL', PARAMETERS) simulates your Simulink model, where 'PARAMETERS' represents a list of parameter name-value pairs, a structure containing parameter settings, or a configuration set.
So, you are calling structure a (returned by LOAD) and the output from glcmn1. I suggest you read this and try to call the function correctly:
doc sim

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by