필터 지우기
필터 지우기

How to use varargout function with matlab coder?

조회 수: 2 (최근 30일)
Jucimar Carpe
Jucimar Carpe 2018년 11월 20일
댓글: Jucimar Carpe 2018년 11월 21일
Hi, i'm trying to convert my Matlab script into C with Matlab Coder app but i'm having a problem, when app get into the "Check for Run-Time Issue" window it tells me: Top-level function cannot have varargout.
I'm not a programer so i have only basic knowledge. How can i procede to overcome this issue?
Thks!

채택된 답변

Ryan Livingston
Ryan Livingston 2018년 11월 20일
Starting in MATLAB R2017b, MATLAB Coder supports varargout in entry-point functions. The documentation:
covers this in more detail.
In earlier releases, you can have a wrapper with explicit output arguments. So if you are trying to generate code for
function varargout = entryPoint(a,b,c)
...
end
you can instead use
function [out1,out2,out3] = entryPointWrapper(a,b,c)
[out1,out2,out3] = entryPoint(a,b,c);
end
and generate code from entryPointWrapper.
  댓글 수: 3
Ryan Livingston
Ryan Livingston 2018년 11월 20일
Yep, the second option, using a wrapper function without varargout, is the best way forward.
That said, looking at your script since there is a lot of plotting and graphics, MATLAB Coder isn't the best tool. As Kojiro Saito and Fred Smith and said in your other question:
MATLAB Compiler would be a better tool for your application because of the plotting/app code.
Jucimar Carpe
Jucimar Carpe 2018년 11월 21일
Hi Ryan, i already done by matlab compiler and created my GUI interface but the i was trying to codify do C, but it's ok. Thanks for the help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by