Main Content

Traitement en arrière-plan

Exécuter du code en arrière-plan pendant l’exécution d’un autre code

Lorsque vous exécutez du code dans MATLAB®, vous devez attendre que son exécution se termine pour pouvoir exécuter un autre code. L'environnement backgroundPool vous permet d’exécuter du code en arrière-plan pendant l’exécution d’un autre code. Par exemple, vous pouvez créer des applications qui continuent de répondre alors que vous effectuez des calculs en arrière-plan.

Utilisez parfeval avec l'environnement backgroundPool pour exécuter une fonction en arrière-plan. parfeval renvoie immédiatement un objet Future qui représente cette fonction. Pour obtenir les résultats de l’objet Future, appelez fetchOutputs.

Fonctions

développer tout

parfevalRun function in background
backgroundPoolEnvironment for running code in the background (depuis R2021b)
fetchOutputsRetrieve results from function running in the background
afterEachRun function after each function finishes running in the background
afterAllRun function after all functions finish running in the background
cancelStop function running in the background
cancelAllStop all functions running in the background (depuis R2022a)
waitWait for futures to complete
fetchNextRetrieve next unread outputs from Future array
FutureFunction scheduled to run
sendSend data to DataQueue or PollableDataQueue
pollRetrieve data from PollableDataQueue
afterEachRun function after data is received on DataQueue
parallel.pool.DataQueueSend and automatically process data
parallel.pool.PollableDataQueueSend and manually retrieve data

Rubriques

En savoir plus sur le traitement en arrière-plan

Applications