Undefined function or method 'sim' for input arguments of type struct

I have created a standalone using deploytool function. It contains four classifiers namely a neural network(ann), SVM architecture,knn and ensemble(again a neural network).
The work flow is as following..
1)get the input from the user
2)load matlab.mat %--this contains my networks, svm architecture and the two matrices(training vector and training target for knnclassify). This file is explicitly called by the main function.
3)classify the input
4)output is generated %-- this approach worked perfectly fine wen run through the editor.. but after compilation wen run thro command command prompt i get the following error msgs..
Class':all:' is an unknown object class. Object ann of this class has been converted to a structure.
Warning: Could not find appropriate function on path loading function handle C:\Program Files(x86)\MATLAB\R2007b\toolbox\bioinfo\biolearning\private\linear_kernel.m>linear_kernel
Class':all:' is an unknown object class. Object ann of this class has been converted to a structure.
Undefined function or method 'knnclassify' for input arguments of type'double'
In the deploytool function i added two files under other files option 1)matlab.mat 2)gui.fig
Any help would be appreciated.. Thanks in advance

 Accepted Answer

Solution 1-16DQNH might be of help.

3 Comments

I was thinking of that kind of solution, but with respect to the knnclassify; I didn't think of it for the object issue.
My guess is that MATLAB Compiler is not adding some Neural Network Toolbox related classes to the CTF archive. Declaring the directive forces all relevant classes to be added to it.
I just followed that solution and it worked!!
and it solved the knnclassify issue too :)
Thanku so much Kaustubha and Walter:)

Sign in to comment.

More Answers (4)

can you explain again the solution Thanks in advance

1 Comment

The solution is to put the line
%#function network
before the load() statement.
This tells the compiler that even though it cannot see any variables of class network being created, that it needs to include the class definition because some network variables are going to "appear" in the workspace (in this case, put there by load() )

Sign in to comment.

thank you, but this time it displays:
warning: An error occurred when running a class's loadobj method.the object that was loaded from the MAT-file was a copy of the object before the loadobj method was run. The rest of the variables were also loaded from the MAT-file.The encountered error was: error using ==> feval Undefined function or method 'traingdx' for input arguments of type 'char'.

1 Comment

NN training functions cannot be compiled (and that is not likely to change any time soon.)
http://www.mathworks.com/products/compiler/compiler_support.html

Sign in to comment.

and so what's the solution ??

1 Comment

There is no solution. You are trying to do something (compile a program that trains a neural net) that Mathworks prohibits for commercial reasons.
Compiled programs can work with pre-trained neural nets, but cannot train neural nets.

Sign in to comment.

I have the same problem with
close_system and get_param
For instance, my GUI contains the command
close_system(model_name,0);
This works fine in case I run the GUI directly in the MATLAB editor.
But after having compiled it to a standalone application. I receive
??? Undefined function or method 'close_system' for input arguments of type
'char'.
(model_name is the name of the SIMULINK model I want to close).
I tried use
%#function simulink
close_system(model_name,0);
but nothing changed.
Thanks in advance for any help!
David

4 Comments

Are you using MATLAB Compiler, or Simulink Coder? MATLAB Compiler cannot compile Simulink.
+1 for Walter's comment. Also see http://www.mathworks.com/matlabcentral/answers/10193-matlab-compiler-and-simulink
Thanks for the quick reply, Walter & Kaustubha.
Right now I am using the deploytool.
I will check the possibilities with Simulink Coder
Thanks again,
David
As far as I understand, there is no possibility to develop a standalone application of a GUI which compiles a given SIMULINK model, right?
Thanks for the help ...

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!