Run code with two sections - app designer

조회 수: 2 (최근 30일)
Shahar ben ezra
Shahar ben ezra . 2021년 7월 13일
댓글: Debt . 2021년 7월 16일
I made an example of a problem I have.
I wrote a code with 2 sections
When I press RUN_1 it calculates X * Y (this is works)
When I press RUN_2 he does not remember the value XY so he does not compute me XYZ (this is not works :( )
  댓글 수: 1
Debt 2021년 7월 16일
you can add private properties to solve this problem

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

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 7월 13일
편집: Cris LaPierre 님. 2021년 7월 14일
You need to keep in mind variable scope. All your callbacks are functions. Variables created inside a function are lost once the function terminates. The way around this in app designer is to create an app property to capture these values. You can then access them using the app.varName syntax.
See here for more.
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2021년 7월 15일
You are not creating a function. You are creating a propery. There is no need to change the name. Use XY. The only change is, instead of using XY, you would now use app.XY.

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

추가 답변 (0개)


Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by