Hot questions for Using Neural networks in matlab guide


I have a workspace called finalnet. Inside the workspace i have a neural network called net. and I want to use the network in one of the functions in my GUI.

Is there a way to do that?

I tried to use evalin function : network = evalin('finalnet','net')

but i get this error:

Error using evalin Unknown command option.


From the wording of your problem it sounds like finalnet is a previously stored workspace such that finalnet.mat is located in some directory. Let's assume the current directory.

In this case you need to load the workspace into your GUI. Assuming that's in some random callback function, you want to call load finalnet or load('finalnet.mat'). Now that the workspace is locally available to your callback function you may access your net.

If you call load finalnet before you run your GUI then you would need to access net using net = evalin('base','net') inside your function. If you make any changes to net or other variables in the base workspace and you want those changes maintained even after exiting the GUI then you must call assignin('base','net'), or whichever variable you changed.


I am trying to build a Neural Network in Matlab that does dropout on the hidden layer using the inbuilt dropoutLayer. So the code is as follows:

layers = [

And I get the following error:

Error in main (line 54)
net = trainNetwork(X,y,layers,options);

Caused by:
    Network: Missing input layer. The network must have one input layer.
    Layer 1: Missing input. Each layer input must be connected to the output of another layer.

which I understand because I haven't given an Input Layer in the layers array. But I am unsure what InputLayer I should give, as the Input is not an image nor a sequence and list of available input layers are:

1) imageInputLayer

2) image3dInputLayer

3) sequenceInputLayer

4) roiInputLayer taken from the official Matlab Docs.

Please let me know what alternative I can use other than defining my own layer.


For everyone who has faced the same issue and is coming over to StackOverflow for help, check the below link posted on the MathWorks community. This actually seems to be working for non-image and a non-sequence input.

This explains a way by which you can use the imageInputLayer to input any kind of data in the Layers array.


I create a GUI that use Parallel computing for accelerating Neural network and SVM models. When I enable Parallel computing in my GUI all thing (MATLAB,My GUI and my code's window) will freeze and I can't maximize these windows either, but my program is working,using workers and sometimes I can see updates in graphs and values of GUI. When I disable Parallel computing in my program everything is normal. In first situation sometimes my GUI turns to black color (Background of GUI,buttons,text-boxes and edit-boxes are good) but values are updating in iterations of created GUI.

What is this problem?



Sorry for the late answer. It is hard to give a definite answer to a solution here. The problem is quite advanced and most of the code we cannot do anthing about. What happens in parfor is probably that matlab puts some kind of lock (mutex or something else) on the elements it accesses at the moment. Also, since parfor works in parallel it is unlikely that any of the data in the loop is ever untouched. The only solution I can see is that you run shorter processes. That will allow your gui to update between the prcesses.

It would probably work to put a drawnow where you want the gui to update.

Other options could also be to place the gui in a location where you does not need to move it or dock it to the main window in matlab. But these are shortcuts which will only hide the problem.