Borrar filtros
Borrar filtros

How do you preallocate an array of FevalFutures?

7 visualizaciones (últimos 30 días)
Chester Koh
Chester Koh el 23 de Oct. de 2023
Respondida: Walter Roberson el 23 de Oct. de 2023
I want to run many experiments using parfeval. How can I preallocate an array of the futures? The sample below results in an error saying the constructor needs more arguments.
experiments = parallel.FevalFuture(100)
for i = 1:100
experiments(i) = parfeval(@magic, 1, 5);
end

Respuestas (1)

Walter Roberson
Walter Roberson el 23 de Oct. de 2023
Loop backwards.
clear experiments
for i = 10:-1:1
experiments(i) = parfeval(@magic, 1, 5);
end
experiments

Categorías

Más información sobre Get Started with Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by