MATLAB: Cd funtion

cdcompilerMATLAB Compilermatlab function

when you use cd funtion and the message you get is MCC use of cd funtion is problematic, what do you do?

Best Answer

From Loren Shure's Blog on Writing Deployable Code by guest-blogger Peter Webb:
Don't rely on the current directory (cd) or changes to the MATLAB path (addpath) to control the execution of M-files. The path of a deployed application is determined at compiled time, and remains forever fixed. The current directory is never on the path in a deployed application. In the code below, cd-ing to the stringFcns directory does not make stringFcns/add shadow mathFcns/add. The order of these functions at runtime depends on what their order was at compile time. This causes errors.