Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

后台处理

在后台运行代码,同时运行其他代码

当您在 MATLAB® 中运行代码时,必须等待该代码完成运行,然后才能运行其他代码。后台池使您能够在后台运行代码,同时运行其他代码。例如,您可以创建在后台执行计算时保持响应的 App。

parfeval 与后台池结合使用可在后台运行函数。parfeval 会立即返回一个 Future 对象,该对象表示在后台运行的函数。要从 Future 获取结果,请调用 fetchOutputs

函数

全部展开

parfeval在后台运行函数
backgroundPoolEnvironment for running code in the background (自 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 (自 R2022a 起)
waitWait for futures to complete
fetchNextRetrieve next unread outputs from Future array
FutureFunction scheduled to run
send将数据发送到 DataQueuePollableDataQueue
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

主题

后台处理快速入门

应用