Borrar filtros
Borrar filtros

how to run two independent functions in matlab?

2 visualizaciones (últimos 30 días)
Dongyan Zhu
Dongyan Zhu el 19 de Abr. de 2020
Respondida: Aditya Mittal el 22 de Abr. de 2020
I have two independent functions:
1: [outputs1]=doModulation(inputs1)
2: LIVE_GUI(input2) % it is a real-time inspector
and my current job is to run both of them simultaneously.
I have installed the Parallel Computing Toolbox and tried the code like this:
parpool(2)
parfor i = 1:2
if i == 1
[parameter1, parameter2]=doModulation(inputs1); % the parameter1 and 2 will be used for the following function
else
LIVE_GUI(input2) % input2 is a struct
end
end
...
[parameter3, parameter4]do_another_process(parameter1, parameter2,...);
But after 10 seconds I received an error message:
Brace indexing is not supported for variables of
this type.
Error in Main_Fcn (line 179)
parfor i = 1:2
Does anybody know how to solve that? Or should I try some other options? Thank you!
  3 comentarios
Dongyan Zhu
Dongyan Zhu el 20 de Abr. de 2020
I have tried that, but it does not work either. And I get the following error message:
Error using parpool (line 113)
Found an interactive session. You cannot have
multiple interactive sessions open
simultaneously. To terminate the existing
session, use 'delete(gcp('nocreate'))'.
Dongyan Zhu
Dongyan Zhu el 20 de Abr. de 2020
p.s. the outputs are parameters

Iniciar sesión para comentar.

Respuestas (1)

Aditya Mittal
Aditya Mittal el 22 de Abr. de 2020
Close all the MATLAB session running on your computer and try again.
ALTERNATIVELY
You can try without using parpool command.

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by