Generate C code from matlab code issue

2 ビュー (過去 30 日間)
xie
xie 2025 年 2 月 11 日
コメント済み: Walter Roberson 2025 年 2 月 13 日
why below uigetfile can't be generate C code? How can I do it?
[file,path]=uigetfile("*.png");

回答 (2 件)

Walter Roberson
Walter Roberson 2025 年 2 月 11 日

Code cannot be generated for uigetdir because the C standard library does not define any directory operations.

Directory operations are defined by Posix, but MATLAB Coder does not target Posix.

You can use coder.ceval to call Posix directory operations such as opendir() and related functions. You are then stuck presenting the information in some kind of graphical user interface. MATLAB Coder has no built-in support for graphics.

  4 件のコメント
xie
xie 2025 年 2 月 13 日
Let me take some time to digest. Thank you!
Walter Roberson
Walter Roberson 2025 年 2 月 13 日
You might be interested in https://github.com/mlabbe/nativefiledialog

サインインしてコメントする。


Raghu Boggavarapu
Raghu Boggavarapu 2025 年 2 月 12 日
We do not support MATLAB Graphics functionality for code generation. If you are primarily interested in getting list of files, you may consider using MATLAB system function and call appropriate command like "ls" to fetch the list of files. We support code generation for system function starting R2024b.
If this does not solve your use case, please share more details here Request Code Generation Support for MATLAB Functions - MATLAB & Simulink

Community Treasure Hunt

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

Start Hunting!

Translated by