Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:57:38+00:00 2026-06-13T02:57:38+00:00

I have Matlab .m script that sets and trains Neural network (nn) using Matlab’s

  • 0

I have Matlab .m script that sets and trains Neural network (“nn”) using Matlab’s Neural network toolbox. The script launches some GUI that shows trainig progress etc. The training of nn usually takes long time.

I’m doing these experiments on computer with 64 processor cores. I want to train several networks at the same time without having to run multiple Matlab sessions.
So I want to:

  1. Start training of neural network
  2. Modify script that creates network to create different one
  3. Start training of modified network
  4. Modify script to create yet another network…
  5. Repeat steps 1-4 several times

The problem is that when I run the scrip it blocks Matlab terminal so I cannot do anything else until the script executes its last command – and that takes long. How can I run all those computations in parallel? I do have Matlab parallel toolbox.


EDIT: Matlab bug??

Update: This problem seems to happen only on R2012a, looks like fixed on R2012b.

There is very strange error when I try command sequence recommended in Edric’s answer.
Here is my code:

 >> job = batch(c, @nn, 1, {A(:, 1:end -1), A(:, end)});
 >> wait(job);
 >> r = fetchOutputs(job)
 Error using parallel.Job/fetchOutputs (line 677)
 An error occurred during execution of Task with ID 1.

 Caused by:
    Error using nntraintool (line 35)
    Java is not available.

Here are the lines 27-37 of nntraintool (part of Matlab’s Neural networks toolkit) where error originated:

if ~usejava('swing')
  if (nargin == 1) && strcmp(command,'check')
    result = false;
    result2 = false;
    return
  else

    disp('java used');
    error(message('nnet:Java:NotAvailable'));
  end
end 

So it looks like the problem is that GUI (because Swing is not available) cannot be used when job is executed using batch command. The strange thing is that the nn function does not launch any GUI in it’s current form. The error is caused by train that launches GUI by default but in nn I have switched that off:

net.trainParam.showWindow = false;
net = train(net, X, y);

More interestingly if the same nn function is launched normally (>> nn(A(:, 1:end -1), A(:, end));) it never enters the outer if-then statement of nntraintool on line 27 (I have checked that using debugger). So using the same function, the same arguments expression ~usejava('swing') evaluates to 0 when command is launched normally but to 1 when launched using batch.

What do you think about this? It looks like ugly Matlab or Neural networks toolbox bug :(((

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:57:40+00:00Added an answer on June 13, 2026 at 2:57 am

    With Parallel Computing Toolbox, you can run up to 12 ‘local workers’ to execute your scripts (to run more than that, you’d need to purchase additional MATLAB Distributed Computing Server licences). Given your workflow, the best thing might be to use the BATCH command to submit a series of non-interactive jobs. Note that you will not be able to see any GUI from the workers. You might do something like this (using R2012a+ syntax):

    c = parcluster('local'); % get the 'local' cluster object
    job = batch(c, 'myNNscript'); % submit script for execution
    % now edit 'myNNscript'
    job2 = batch(c, 'myNNscript'); % submit script for execution
    ...
    wait(job); load(job) % get the results
    

    Note that the BATCH command automatically attaches a copy of the script to run to the job, so that you are free to make changes to it after submission.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Matlab (Neural Network Toolbox + Image Processing Toolbox), I have written a script
I have been currently using a Matlab script that plots a function and prints
I have to write a Matlab script that does this: The input is 2
I have a matlab script, lets call it master.m, that loads a file called
I have developed code on a m-file script in Matlab that communicates with a
I have a Matlab script that requires a function in a DLL, and calls
I am using a script in MatLab that works perfectly fine by itself, but
I have a R script I'm running now that is currently using 3 correlated
I have created a MATLAB GUI using GUIDE. I have a slider with a
I have a matlab script that converts the images from png to jpeg. However

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.