Azzera filtri
Azzera filtri

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

5 visualizzazioni (ultimi 30 giorni)
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 Commento
Walter Roberson
Walter Roberson il 30 Gen 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.

Accedi per commentare.

Risposte (3)

Rina Blomberg
Rina Blomberg il 15 Mar 2015
Modificato: Rina Blomberg il 15 Mar 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 il 31 Ott 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 il 29 Nov 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

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by