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

 채택된 답변

Adam Danz
Adam Danz 2019년 5월 8일
편집: Adam Danz 2019년 5월 8일
"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

The second part returns the following error
%No appropriate method, property, or field 'UITablle' for class 'Estimator'.
Adam Danz
Adam Danz 2019년 5월 8일
편집: Adam Danz 2019년 5월 8일
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 2019년 5월 8일
편집: Adam Danz 2019년 5월 8일
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 2019년 5월 8일
편집: Adam Danz 2019년 5월 8일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

릴리스

R2018a

질문:

Lui
2019년 5월 8일

댓글:

2019년 5월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by