MATLAB Answers

0

UI graphics objects taking several minutes to update when running App Designer application, can I speed this process up?

Asked by AdamG2013468 on 2 Aug 2019
Latest activity Commented on by AdamG2013468 on 15 Aug 2019
My application uses an app.Button to execute approximately 80-90 lines of code for importing data from a spreadsheet. I have learned that the import code within the ButtonPushed(app, event) function itself runs very quickly (1.5-2 seconds), but for the UI of application to update (app.EditTextField, and app.ListBox.Items being updated) with the newly imported information takes over two minutes.
I have pinpointed the slowdown using the profile on, profile viewer, functions (see images below), but don't have a strong enough programming background to interpret. Can anyone advise on how to potentially improve the update speed of my application graphics?
ProcessDTS_Snip4.PNG
ProcessDTS_Snip6.PNG
ProcessDTS_Snip5.PNG

  0 Comments

Sign in to comment.

2 Answers

Answer by Harsha Priya Daggubati on 8 Aug 2019

Hi,
It would be more helpful if you could provide information about what type of data are you trying to load into AppDesigner. One guess would be you are loading a very large numeric data loaded. If that's the case, you try simplifying the data by assocating an id with real data to avoid processing the whole lot of data.
Hope this helps!

  2 Comments

Your assumption is correct. I am loading a large .csv file with 15 columns of numeric data and a relatively small amount of header information (43 MB file) using the fopen and textscan functions.
As I mentioned before, the code within the ButtonPushed callback function takes a small amount of time to run according to the tic toc functions (~1.5 seconds), but while watching the actual application window, the EditTextField.Value, Lamp.Color, and ListBox.Items don't update for about two minutes of waiting.
According to the above images, what seems to be taking so long is converting from MATLAB numerical values to Java Values. Would the only way to speed this up be to try converting to a more manageable data type, such as singe instead of type double (i will try this in the meantime)?

Sign in to comment.


Answer by Harsha Priya Daggubati on 9 Aug 2019

It would be helpful if you can share the MATLAB Code and the type of data you are loading from spreadsheet. As you mentioned that you are updating EditTextField.Value, Lamp.Color, and ListBox.Items, I think none of those properties accept a numeric value with 15 columns.Also, edit field value and listbox items only accept char array/cellstr and Strings.

  1 Comment

The code would take quite some time to copy considering it is saved on a seperate non-networked computer. What more would you like to know about the spreadsheet data? The spreadsheet is 300178 X 16 elements with numerical data in the format 0.000000. After some investigating, the line of code that is taking the longest time is simply:
app.ActiveChannelsListBox.ItemsData = RawData(1, 2:end);
Where RawData contains the numerical spreadsheet info described above. There may simply be no way of speeding this up.
Again, the code runs perfectly fine with no errors, it just takes longer than I would expect it to.

Sign in to comment.