How can I make my GUI program to run faster?

Hello Guys,
I have developed a program in GUI. Program do contians few graphs to develop. But my GUI program is executing very slowly. It is taking almost 10-15 min to plot a normal time vs. amplitude graph. How can I speedup the execution. Do we have any coding to write before we plot graphs in GUI.
I tried using {draw now};
Thanking you.
Meera

4 Comments

Have you run the profiler on it?
profile on
% Your code
profile off
profile viewer
to tell you where it is slow?
Plotting a line certainly shouldn't take that long. Do you have a calculation that takes place before the plotting?
Hello Adam,
Yea it includes some calculations. I have attached the code below. But when I execute the same code on Matlab editor it executes fast enough.
{ plot(time,Data); % plot of signal vs. time
title('Signal Vs. time')
xlabel('time (seconds)')
ylabel('x (amplitude)')
[f,mx,handles] = FFT_Calculation(Data,Fs,handles);
repot_path = fullfile(pathname,'\',
[File_Name 'FFT_of_Original_Signal.txt']);
dlmwrite(repot_path,mx,'precision', '%.6f','newline','pc'); }
And where does the profiler tell you the time is being spent when run from a GUI that it isn't when run from a script?
Hello Adam,
When I run the GUI script it is taking lot of time to execute the plots. But when I copy the same code on the script editor (without GUI), program is executing plots fast enough. In GUI script it is taking lot of time in loading data for plots, but whereas in normal scripts editor when I copy that part of program and do, It executes fastly.

Sign in to comment.

Answers (1)

Jan
Jan on 14 Apr 2015
Please run the profiler and post a copy of the line, which needs the most time. This is more useful to identify the problem than a description as a text.
Plots are getting slow, when there are many (> thousands) older objects in the figure already. If you observe different run times if you run the code inside your GUI or from the editor, there are differences between the surrounding code. So please post a relevant part of the code, which reproduces the problem. You can replace the data with random arrays most likely to keep it simple.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Asked:

on 13 Apr 2015

Answered:

Jan
on 14 Apr 2015

Community Treasure Hunt

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

Start Hunting!