How to callback variable and command in any function using App Designer
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I am new to Matlab and I have having trouble using App designer. I am currently making a GUI to control a microscope through a program called micromanager. So pretty much the 3 commands below is what I need to access the microscope through micromanager. I do not want to keep writing this in every button function, I just want to write it once somewhere and call it back when needed. For example, when taking creating a snap shot button, I need to have a function which executes mmc.snapImage(), but if I do not have the 3 lines below in the same function, it does not recognize 'mmc'. I tried inserting this in the startUpFcn but that does not work. Is there anyway I can simply write the 3 lines of code once and call it back whenever in other functions.
import mmcorej.*;
mmc = CMMCore;
mmc.loadSystemConfigureation('location in C drive.....')
댓글 수: 0
답변 (1개)
ES
2018년 5월 29일
set the mmc to the app object in the startup function. In other functions you can use the app object.
% In startup function.
import mmcorej.*;
mmc = CMMCore;
app.mmc = mmc
mmc.loadSystemConfigureation('location in C drive.....')
and
%In other functions
mmc = app.mmc;
mmc.snapImage()
댓글 수: 0
참고 항목
카테고리
Help Center 및 File 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!