Loading a generated array into a visible table in AppDesigner

Hi everyone,
I am creating an application that can be used to display imported data into a table, plot the same data into histograms, scatter plots and general plots.
I have two issues that I would like help on.
How do I pass the results obtained from one function to the next function. for example, how do I get my imported data to plot without repeating the whole code?
Secondly, how can I display my already imported data in form of a table in AppDesigner as it is

 Réponse acceptée

Adam Danz
Adam Danz le 8 Mai 2019
Modifié(e) : Adam Danz le 8 Mai 2019
"How do I pass the results obtained from one function to the next function. for example, how do I get my imported data to plot without repeating the whole code? "
There are several ways to do this. Assuming the import function is defined within your appdesigner file, the cleanest method would be to merely pass the data into the plotting function as an additional input. Alternatively, you could store the data in the "UserData" property of the axis handle and then retreive it from within your plotting function.
app.UIAxes.UserData = myData; %store the data
myData = app.UIAxes.UserData; %retrieve the data from within the plotting function
Secondly, how can I display my already imported data in form of a table in AppDesigner as it is
Here's instructions how to set up the table when the app first starts
And here are some demos showing how to update the table once there is new data

10 commentaires

The second part returns the following error
%No appropriate method, property, or field 'UITablle' for class 'Estimator'.
Adam Danz
Adam Danz le 8 Mai 2019
Modifié(e) : Adam Danz le 8 Mai 2019
I'd need to see the relevant section of code that is generating the error. Perhaps a typo (you have two L's in UITable)? Also, perhaps you're trying to access the wrong object. What's the Estimator class object?
Estimator is the Classdef:
I have loaded and generated a table already. I would like to display using the user interface at on the appDesigner. Please have a look below
M2002=table2array(M2002(:,2:20));
x=M2002;
app.Load_DataButton.UserData = x;
% Cell edit callback: UITable
function UITableCellEdit2(app, event)
x = app.Load_DataButton.UserData;
app.UITablle.Data={x}
%yields the error below
%Error setting property 'Data' of class 'Table':Data within a cell array must have size [1 1]
Error setting property 'Data' of class 'Table':
Data within a cell array must have size [1 1]
Adam Danz
Adam Danz le 8 Mai 2019
Modifié(e) : Adam Danz le 8 Mai 2019
Could you share a sample of {x} if it's too large to copy-paste the entire array? My guess is that one of the cells in the array contains more than 1 element. There must be one element per cell in the table.
If your data are a matrix (numeric), then you shouldn't be putting it into a cell array.
Attached id the file
Thanks. What happens when you input the matrix (instead of converting it to a cell array)?
app.UITablle.Data= x; % not {x}
Thank you so much Adam for walking through this with me. I feel like calling you. It works.
Adam Danz
Adam Danz le 8 Mai 2019
Modifié(e) : Adam Danz le 8 Mai 2019
haha no problem. Glad I could help.
hi Adam
Could you please take a look at this? It is part of the problem I am trying to sort
I will appreciate your feedback on this set of problem
I replied there.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by