MATLAB fails before generating PLC code for transfer into Omron CX-Programmer because it cannot create its output directory. The reported message identifies a filesystem write-access problem, not a confirmed PID-model or PLC-logic error.
Identify the Failed Operation
Error creating directory "./rtwgen_tlc": Permission denied.
The ./ prefix makes rtwgen_tlc relative to MATLAB's current working directory. Generation cannot proceed until MATLAB can create that directory there or the project runs from another writable location.
Separate Confirmed Facts from Unknowns
| Evidence | Engineering conclusion |
|---|---|
Directory creation returns Permission denied
|
The immediate failure is filesystem access during output-directory creation. |
The target path is ./rtwgen_tlc
|
Inspect MATLAB's current working directory and that relative path. |
| No operating system, MATLAB release, PLC Coder release, or folder path is supplied | Do not attribute the failure to a specific version, operating-system policy, or product defect without further evidence. |
Restore Write Access and Regenerate
- Identify MATLAB's current working directory at the moment PLC code generation starts.
- Confirm that the active user can create a directory in that location. If not, move or open the project in a directory where that user has write access.
- Inspect whether an existing item named
rtwgen_tlcprevents directory creation or is not writable. Preserve project data while correcting its access or location. - Run PLC code generation again and observe whether MATLAB creates
rtwgen_tlc.
Changing the PID implementation is not justified by the available evidence. Resolve the directory-creation failure before investigating generated-code compatibility with CX-Programmer.
Verify the Correction
The access problem is cleared when generation proceeds past the reported message and MATLAB successfully creates or writes to rtwgen_tlc. If the same message remains, record the resolved current directory, ownership and access state of the parent directory, and whether an item with the target name already exists; these observations distinguish a parent-directory restriction from a collision at the output path.
FAQ
What does MATLAB PLC Coder permission denied mean?
For this case, MATLAB could not create ./rtwgen_tlc. Check write access to MATLAB's current working directory before troubleshooting the PID logic.
Where is the rtwgen_tlc directory created?
The leading ./ indicates that rtwgen_tlc is relative to MATLAB's current working directory when generation begins.
Does this error prove the PID is incompatible with CX-Programmer?
No. The evidence shows code generation stopping at directory creation, so PID or CX-Programmer compatibility cannot be evaluated until filesystem access is restored.