GUI Uitable: set column data to variable

2 Ansichten (letzte 30 Tage)
Brian
Brian am 6 Aug. 2012
Kommentiert: Taral Shah am 16 Sep. 2014
Hey, all, thanks for reading this,
I set up a GUI uitable with some data, and I would like to use that data in another callback function. I was wondering, how do I select data on a column by column basis in other callback functions and assign it locally to variables?
Thanks for your advice

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 6 Aug. 2012
% i am not sur that i have understood
data=get(handles.uitableName,'Data')
%data is a cell array, then extract any column you want
c1=data(:,1) % the first column
  2 Kommentare
Brian
Brian am 6 Aug. 2012
Thanks, this is what I ended up doing, worked great.
Taral Shah
Taral Shah am 16 Sep. 2014
data=get(handles.uitableName,'Data') If we do this, it extract all the data from table.Is there any way that i can extract selected data (highlighted) only?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Seyhan Emre Gorucu
Seyhan Emre Gorucu am 6 Aug. 2012
Bearbeitet: Seyhan Emre Gorucu am 6 Aug. 2012
Hello,
You need to assign a CellEditCallback function to the table. You can do it both programmatically and from the guide. Once you change something on any editable column, it should go that function. You can get all the data from
get(eventdata,'Data')
You can also get other information via
Indices.Indices
Indices
This would be something like:
mytable_CellEditCallback(eventdata,Indices)
get(eventdata,'Data')
Indices.Indices
Indices
end
Don't forget the assign the function first.
  1 Kommentar
Brian
Brian am 6 Aug. 2012
Thanks, I tried this and it worked out pretty well. I ended up keeping
data=get(handles.uitableName,'Data')
%data is a cell array, then extract any column you want
c1=data(:,1) % the first column
because it was a bit simpler. I will keep this in mind, though.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by