You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to create an FMU from a simulink model, I received the following error:
C:\Users\USERID1\AppData\Local\Temp\tpdeb91cc8_6d09_4157_9226_606a8095eb0d\zzzzz_to_be_fmu_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz_fmu_sfcn_rtw_fmi\FMUArchive is not a directory.
This did not happen every time, but I believe occurred after a prior failure.
Solution
I was able to detect where the error occurs and fix it. The issue is that rtwsfcnfmi_make_rtw_hook() uses exist() to check existence of the FMUArchive directory, but does not specify a full path to it. Therefore, it will return that the directory does exist if some folder with that name lives somewhere in your MATLAB path.
This is the reason for MATLAB suggests using isfolder() instead.
Problem:
% remove FMU build directory from previous buildif exist('FMUArchive', 'dir')
rmdir('FMUArchive', 's'); %This line could be executed even if FMUArchive does not live in the current directory! (which causes an error)end
Fix:
% remove FMU build directory from previous buildif isfolder('FMUArchive')
rmdir('FMUArchive', 's');
end
The following logic should be changed where applicable:
Problem
When attempting to create an FMU from a simulink model, I received the following error:
This did not happen every time, but I believe occurred after a prior failure.
Solution
I was able to detect where the error occurs and fix it. The issue is that
rtwsfcnfmi_make_rtw_hook()
uses exist() to check existence of theFMUArchive
directory, but does not specify a full path to it. Therefore, it will return that the directory does exist if some folder with that name lives somewhere in your MATLAB path.This is the reason for MATLAB suggests using isfolder() instead.
Problem:
Fix:
The following logic should be changed where applicable:
exist(<something>, 'dir')
➡️isfolder(<something>)
exist(<something>, 'file')
➡️isfile(<something>)
From a quick search, I found 8 spots that may need this update.
System details:
The text was updated successfully, but these errors were encountered: