Borrar filtros
Borrar filtros

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

5 visualizaciones (últimos 30 días)
Talal
Talal el 29 de En. de 2012
Respondida: Rinku Kumar el 31 de Oct. de 2018
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 comentario
Walter Roberson
Walter Roberson el 30 de En. de 2012
We need to see the call, and for any parameter passed in which is a variable, we need to know class() of that variable.

Iniciar sesión para comentar.

Respuestas (3)

Rina Blomberg
Rina Blomberg el 15 de Mzo. de 2015
Editada: Rina Blomberg el 15 de Mzo. de 2015
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 el 31 de Oct. de 2018
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 el 29 de Nov. de 2012
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

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by