MATLAB Answers

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

1 view (last 30 days)
AdamG2013468 on 2 Aug 2019
Commented: 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?


Sign in to comment.

Answers (2)

Harsha Priya Daggubati
Harsha Priya Daggubati on 8 Aug 2019
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!


AdamG2013468 on 8 Aug 2019
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.
AdamG2013468 on 8 Aug 2019
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.

Harsha Priya Daggubati
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

AdamG2013468 on 15 Aug 2019
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.