gui takes prettty much time for launching?

1 次查看(过去 30 天)
hi, In my gui i have a images slideshow and some text its working right but the problem is gui takes pretty much time for launching and when i comment images slideshow code it get start quickly... now how to resolve this issue?
  4 个评论
Image Analyst
Image Analyst 2014-2-2
If I told you MY program was slow, can you tell me why my program is slow if I don't show you the code? You need to see the code. Did you use the MATLAB compiler to turn your program into a standalone executable?
romasha
romasha 2014-2-2
编辑:Walter Roberson 2014-2-2
Code
function fgui2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to fgui2 (see VARARGIN)
% Choose default command line output for fgui2
handles.output = hObject;
imgNameList = {'images.jpg','images (1).jpg','images (2).jpg','download.jpg','images (4).jpg','images (5).jpg','images (6).jpg','images (7).jpg','eye3.jpg'};
subplot(2,2,4);
pause on;
for i = 1:length(imgNameList)
a = imread(imgNameList{i});
imshow(a);
drawnow;
pause(3);
end
% Update handles structure
guidata(hObject, handles);

请先登录,再进行评论。

采纳的回答

Shivaputra Narke
Shivaputra Narke 2014-2-2
You can use following code to run slideshow because it will run in background.
function slideshow
global indx
indx=1;
showTimer=timer('timerFcn',@timefcn);
set(showTimer,'ExecutionMode','fixedRate');
start(showTimer)
function timefcn(varargin)
global indx
imgNameList= char('1.jpg','2.jpg','3.jpg');
a=imread(imgNameList(indx,:));
indx=indx+1;
if indx>10
indx=1;
end
imshow(a);
drawnow;

更多回答(1 个)

Shivaputra Narke
Shivaputra Narke 2014-2-2
As your code is not present here its difficult to say anything. But,if gui is taking time in launching that means you have written a bunch of code in its opening function that takes time. I am not sure but this may be one of the reason.
  2 个评论
romasha
romasha 2014-2-2
编辑:Walter Roberson 2014-2-2
Code
function fgui2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to fgui2 (see VARARGIN)
% Choose default command line output for fgui2
handles.output = hObject;
imgNameList = {'images.jpg','images (1).jpg','images (2).jpg','download.jpg','images (4).jpg','images (5).jpg','images (6).jpg','images (7).jpg','eye3.jpg'};
subplot(2,2,4);
pause on;
for i = 1:length(imgNameList)
a = imread(imgNameList{i});
imshow(a);
drawnow;
pause(3);
end
% Update handles structure
guidata(hObject, handles);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by