Matlab app - Using properites(app) opens another instance of the app
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I am trying to write a function that will save apps properties to a .mat file. To do this I have called properties(app) and then loop over these properties until I get the the properties I want to save. However, my function causes another window of the app to open. After some troubleshooting I realise that this occurs when properties(app) is called. my code is included below for clarity.
function savesimfile(app, filename, fileloc)
props = properties(QFM3);
savestate = 0
savestartmarker = 'SaveDataStart'
for iprop = 1:length(props)
ipropname = props{iprop}
if ipropname == savestartmarker
savestate = 1
elseif savestate == 1
disp(ipropname)
end
end
end
댓글 수: 3
Walter Roberson
2023년 10월 2일
props = properties(QFM3);
Is QFM3 the name of the class? If so then that statement would be calling the class constructor.
채택된 답변
Walter Roberson
2023년 10월 2일
Change
props = properties(QFM3);
to
props = properties(app);
This assumes that savesimfile is a method of class QFM3.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!