'GUIDE' table from imported values

1 次查看(过去 30 天)
Hello all,
Hoping you can help, ive been going round in circles the last few days trying to get this very basic guide application to work.
The push button runs a .m file. this then breaks the file up into 4 column vectors each with 10 entires , A, B, C and D.
How do i get these vectors to appear up when i press the push button to initial the script.
Ive tried going through the tutourials, just cant seem to make it work. currently using 2019a
Thanks in advance!
Joe
  3 个评论
Joe Gee
Joe Gee 2019-8-15
Hi Geoff,
Sorry for not being clearer.
The push button is indeed a call back for a script (myscript.m).
This script loops through 10 files and pulls out 4 peices of information per file. and lists to variables A,B,C,D.
As you have suggested i have also generated a table from these using array2table function, resulting in a table which is a 4x10 matrix. This variable name is 'mytable'.
So when the push button is clicked it will callback the script, and plot the table to the table shown in the GUI.
Thank again,
Joe
Geoff Hayes
Geoff Hayes 2019-8-15
Joe - I think that you will want to convert your script (myscript.m) into a function so that it returns a 4x10 matrix (not a table - no need to convert using array2table) that your callback function will then use to populate the table. Something like
function myPushbutton_Callback(hObject, eventdata, handles)
% call your function to get the data
myData = myFunction();
% populate the table
set(handles.uitable1, 'Data', myData);
Note that you may need to massage the myData so that it is a cell array (I can't remember off the top of my head).
Your function will look something like
function [data] = myFunction
data = [];
% read the data from file
data = [A B C D];
or something similar to the above.

请先登录,再进行评论。

采纳的回答

Waqar Ali Memon
Waqar Ali Memon 2019-8-15
Hello Joe Gee,
Since, your Pushbutton is running the script (i.e. executing the functions) but not diplaying the results. It means you have not defined the output for your table.
In order to show the results in a table.
You have to add following command in Pushbutton function:
set(handles.uitable1, 'Data', NameOfYourVariableThatContains4Vectors);
I hope, this will work.
Regard,s
Waqar Ali

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by