Current Directory for Generated Code

3 views (last 30 days)
pwd Doesn't seem to be supported for code generation. How might one get the current directory when deploying code with code generator?

Accepted Answer

Walter Roberson
Walter Roberson on 22 Jun 2022
MATLAB Coder is designed to target embedded systems, so functionality that is not part of the C Standard Library is often not available. DSP and so on often have no file system.
If you are targeting MacOS or Linux then coder.ceval to the appropriate system call. Windows uses a different system call.
https://stackoverflow.com/questions/298510/how-to-get-the-current-directory-in-a-c-program
  1 Comment
Michael
Michael on 5 Nov 2022
The code for using the getcwd() C function within coder.ceval() can be found in this answer .

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by