Matlab GUI and slow execution

3 ビュー (過去 30 日間)
Alberto Ducci
Alberto Ducci 2015 年 5 月 11 日
回答済み: Jan 2015 年 5 月 12 日
Hello, i'm writing a program that plots some data from 8 temperature sensors . the sensors are connected to the pc through the serial port and the samples arrives every 6 seconds. At start the program works as it should, but after an hour from begin of acquisition it is slower than after a few minutes. I actually do cla every cycle and don't use eval. i've also limited the use of global variables. what can i try to increase performances of my program. thank you alberto
  1 件のコメント
Thomas Koelen
Thomas Koelen 2015 年 5 月 11 日
How are you storing your data?

サインインしてコメントする。

採用された回答

Alfonso Nieto-Castanon
Alfonso Nieto-Castanon 2015 年 5 月 11 日
not much we can do without seeing the code, but as you suggest one possible reason for the slowing down could be if the number of graphic objects being displayed is increasing over time (e.g. if you forgot to delete some object during each iteration). I would suggest to either try clf instead of cla, and/or check if numel(findobj(gcf)) is increasing over time. Another potential reason would be if you are accumulating some data into a non-preallocated array (so Matlab needs to reallocate bigger and bigger chuncks of continuous memory to fit that ever increasing variable)
Good luck!
  1 件のコメント
Alberto Ducci
Alberto Ducci 2015 年 5 月 12 日
solved! thank you very much...i created every cycle a static text...after 10 minutes there were already 500!

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2015 年 5 月 12 日
The profiler is the best method to identify the bottlenecks of your code. See doc profile . It is not worth to "optimize" lines, which use only 2% of teh runtime, but usually the profiler reveals, which line uses the majority of the time. Then post the relevant part of the code here - by editing your question. Please do not post important information as a comment or as a pseudo-answer.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by