Saving a neural network within a GUI and opening it back up

1 view (last 30 days)
I'm having problems with saving a neural network and loading it back up. Refer to this post that I made in regards to loading a saved neural network ( saved from the workspace not the GUI) http://www.mathworks.com/matlabcentral/answers/74032-problems-with-a-saved-neural-network
I was having problems saving a trained neural network. I kept getting the error saying that 'handles.neural_net' is not a valid variable name. I then realized that Matlab does not like '.' in variable names. So within my save neural network callback I created a variable save_net = handles.neural_net. I used this variable in save(). This worked.
Now when I open this trained network and hit my "run neural network" button, I get an error saying 'model' parameter must be a string.
As mentioned in the link posted above, I use the code below to load the saved network. Can anyone find what I'm doing wrong with saving and loading neural networks using handles? I need to be able to use handles for the neural network because it gets passed around from the file select callback to the training or run callback (depending on if you are performing a training or run of the network).
trained_net_vars = load(FileName);
handles.neural_net = trained_net_vars.net;
Note: The training, running, and saving of the network is all done in the GUI. I want to be able to simulate the network using a different input than the input used for training.

Accepted Answer

Walter Roberson
Walter Roberson on 1 May 2013
If the variable you are saving into is named "save_net", then the field name you used after trained_net_vars needs to be "save_net".

More Answers (0)

Categories

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

Products

Community Treasure Hunt

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

Start Hunting!