필터 지우기
필터 지우기

arguments in embedded coder

조회 수: 2 (최근 30일)
Emmanuel Luevano
Emmanuel Luevano 2012년 12월 10일
Hi, I just want to know, If is correct the next function.
function [p,L] = exchange2 (p,D)
I mean, to have the same name to input variable and output variable.
another doubt is if Can I use the same variable name, but in different functions in the same file. I explain well.
regards!

채택된 답변

Walter Roberson
Walter Roberson 2012년 12월 10일
Yes, it is fine to have the same variable name on input and output.
Yes it is fine to use the same variable name in different functions.
  댓글 수: 1
Emmanuel Luevano
Emmanuel Luevano 2012년 12월 10일
thanks a lot dude!!!

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

추가 답변 (1개)

Ryan Livingston
Ryan Livingston 2012년 12월 17일
Moreover, using the same variable as an input and output may trigger an optimization which reduces copies in the generated code. Namely, the input "p" may be passed by reference in this case:

Community Treasure Hunt

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

Start Hunting!

Translated by