필터 지우기
필터 지우기

Execute a code section with a button

조회 수: 1 (최근 30일)
leonidas86
leonidas86 2018년 7월 26일
댓글: Adam 2018년 7월 26일
Hello,
I have multiple code sections in my m-file separated with the double %% sign. Each code section outputs a plot. Now I want to create a GUI with multiple buttons for each plot. How can I program that a button executes a certain section?
  댓글 수: 5
leonidas86
leonidas86 2018년 7월 26일
Yes ok so I can share data between functions. But my problem is that I have a simulink model which outputs data in the workspace. Then one section of my program reads and process the data, the next one calculates some values for the plots and the other sections plot the data into multiple diagrams. But meanwhile the program is so big that I want to split it into several parts.
What is the easiest way to do that?
Adam
Adam 2018년 7월 26일
I'm afraid I know nothing about how Simulink works with workspaces as I have never used it so I'll have to leave that to someone else. /breaking data into functions and passing in only the variables the function itself needs is usually the best way to break down a large program though, or use OOP to create classes, but that is rather more advanced, though does solve problems of sharing data between multiple workspaces more neatly.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Model, Block, and Port Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by