主要内容

后台和并行处理

在后台或在指定时间运行代码

MATLAB® 包含设置程序执行计时器以及在后台运行代码的功能。

函数

全部展开

timer调度 MATLAB 命令的执行
delete删除文件或对象
isvalid确定有效句柄
start启动计时器
startat排定计时器在指定时间触发回调
stop停止计时器
timerfind查找计时器对象
timerfindall查找所有计时器对象
wait阻止命令提示符直到计时器停止运行

后台执行

parfeval在后台运行函数 (自 R2021b 起)
parfevalOnAll在后台在所有工作单元上运行函数
backgroundPool在后台运行代码的环境 (自 R2021b 起)

Futures

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
cancel停止在后台运行的函数
cancelAllStop all functions running in the background (自 R2022a 起)
wait等待 future 完成
fetchNextRetrieve next unread outputs from Future array
FutureFunction scheduled to run

数据队列

send将数据发送到 DataQueuePollableDataQueue
pollRetrieve data from PollableDataQueue
closeClose pollable data queue (自 R2025a 起)
afterEachRun function after data is received on DataQueue
parallel.pool.DataQueueSend and automatically process data
parallel.pool.PollableDataQueueSend and manually retrieve data
parallel.pool.ConstantCopy or create data only once on workers in parallel pool (自 R2021b 起)

主题