App inside app question

조회 수: 4 (최근 30일)
Lucia Wagner
Lucia Wagner 2020년 6월 2일
댓글: J. Alex Lee 2020년 6월 8일
Hello MATLAB community!
I am an undergraduate new to MATLAB, and I am trying to build an app inside MATLAB to collect/analyze data for a neuroscience research project.
Is it possible to build an app (or in my case, four apps) within a "mother" app? I tried creating one app but it was ridiculously slow to load an image. I hope linking different apps will make this process much quicker.
If this is possible, how do I go about connecting the apps? Thanks so much!
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2020년 6월 3일
Lucia - please discuss how you are creating your GUIs. Are you programmatically creating the GUI, or are you using either App Designer or GUIDE? Also, show your code on how you are loading the image. What does "slow" mean? How large is the image? Are you doing any sort of analysis on the image before you display it? (I don't see how having four apps will make the process go quicker...)
Lucia Wagner
Lucia Wagner 2020년 6월 5일
Hi Geoff,
Thanks for the response! We are using App Designer to analyze imaging data. Each data set comes in groups of four RGB images that are fairly large around 400 KB each. Please see attached sample code that is a simplified version of our code.
properties (Access = public)
Image1
Image2
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: Image1Button
function Image1ButtonPushed(app, event)
if isempty(app.Image1)
fn = imgetfile();
app.Image1=imread(fn);
end
cla(app.UIAxes);
image(app.UIAxes,app.Image1);
end
% Button pushed function: Image2Button
function Image2ButtonPushed(app, event)
if isempty(app.Image2)
fn = imgetfile();
app.Image2=imread(fn);
end
cla(app.UIAxes);
image(app.UIAxes,app.Image2);
end
end
It is slow to render images onto the axes/toggle between Image 1 and Image 2 with the arrow keys (at least 30 seconds to a minute). Our goal is to collect data on each figure through mouse clicks that can be saved and transferred between each figure. We want to toggle as quickly as possible between figures.
I am wondering if it is quicker to have four separate figure windows (the four "child" apps) instead of a single axes in one window. Here is a rough sketch of the two layouts.
We are not doing analyses on the image prior to showing it.
Thanks so much!

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

채택된 답변

J. Alex Lee
J. Alex Lee 2020년 6월 7일
If not more than 1 image needs to be displayed at once, maybe just save all the image data internally, have only one axes, and have your arrow key presses just draw the appropriate image on the axes
400kb image is not huge, but of course if the source is compressed, it could still be a lot of pixels, which could be slowing you down..if you don't need the displayed image to be full resolution, maybe downsample and store as a "thumbnail" for display purposes?
Not really "app-in-app", but have you explored the use of "tabgroup"?
  댓글 수: 2
Lucia Wagner
Lucia Wagner 2020년 6월 8일
Hi Alex,
Yes, that did the trick! Thanks so much for your help!
J. Alex Lee
J. Alex Lee 2020년 6월 8일
Glad to be of help!

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

추가 답변 (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