Rather simple question, but I can't seem to find any example of it.
When in live script, a local function can be created, which I have no issue doing manually.
However, there is the option on right click, to "Convert to Local Function".
When I try to do so, I get "to make the section be analyzable, specify variable to clear explicity. (line 1)"
Does anyone have an example or link to when a section of script can be change from code to a local function. I cant find an example online.

댓글 수: 1

Deepak Gupta
Deepak Gupta 2022년 5월 17일
Can you share the code you selected to produce above message? I am unable to produce this message and generating local function from script is working fine.

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

 채택된 답변

Cris LaPierre
Cris LaPierre 2022년 5월 17일

0 개 추천

It is bad practice - and completely unnecessary - to create a function where the first command is clear. Remove this line of code from your script before trying to convert it to a function.

댓글 수: 1

Gerard Nagle
Gerard Nagle 2022년 5월 18일
편집: Gerard Nagle 2022년 5월 18일
Hi Chris,
Thanks for the reply, it seems like the clear at the start of the script was the issue, as it worked fine when I removed it.
Thank you for yoru reply.
Gerard

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2022년 5월 17일

편집:

2022년 5월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by