Force variable name in code generation

Hi, Is there any way to force MATLAB Coder use a spesific name for an input variable in code generation?
To clarify, if my matlab function header is
function Foo(myVar)
I wish to make sure that the C function header would look like
void Foo(TypeOfVar myVar)
currently I am getting something like
void Foo(TypeOfVar b_myVar)

回答 (1 件)

Hassaan
Hassaan 2024 年 1 月 5 日

0 投票

% Example MATLAB function
function Foo(myVar)
%#codegen
% Your code here
end
% Code generation configuration
cfg = coder.config('lib');
cfg.CStructName = 'MyStruct'; % Only if you're using structs
% Generate C code
codegen('Foo', '-config', cfg, '-args', {0}); % Replace {0} with actual input type/size
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

質問済み:

Y
Y
2014 年 12 月 22 日

回答済み:

2024 年 1 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by