Issue to remove generated mex file after Simulink Model execution in parfor

조회 수: 2 (최근 30일)
I want to run a Simulink model inside a parfor loop.
Since the model involves code generation, each parallel iteration runs in a different temporary directory, as suggested in the related documentation. This is to avoid data concurrency issues.
In particular, after the execution of the model using the sim command, one wants to remove the temporary directory with its content, in order to avoid accumulating useless temp data.
However, when running rmdir(tmpdir,'s') I get the error
"C:\path\myModel_sfun.mexw64 could not be removed".
I tried adding the commands
munlock myModel_sfun.mexw64
fclose('all')
close_system(mymodel,0)
But this doesn't help. Any help? Thanks Luca

채택된 답변

Friedrich
Friedrich 2013년 7월 19일
Hi,
try a
clear mex
before removing the directory.
  댓글 수: 1
Luca Barbiero
Luca Barbiero 2013년 7월 19일
Thanks Friedrich, it works. Only,the keyword clear is underlined in red in the editor, and the reason is
"The function CLEAR might make an invalid workspace access inside PARFOR loop".
But apparently in this case it's ok. Luca

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by