Thread Subject: setting uitable cell choice list during run-time

Subject: setting uitable cell choice list during run-time

From: Bastian

Date: 11 Sep, 2009 14:06:06

Message: 1 of 5

Hello Folks,

I have created a uitable using GUIDE's uitable "Table Property Editor" during design time. I have made several columns "Choice Lists" to set the dates. The first column choice list is a static list of months (e.g. Jan, Feb, Mar etc). I would like to set the second choice list column to reflect the number of days of the month that the user chooses from the first choice list (during run-time). Essentially I need to know how to access an individual uitable cells' choice list property in order to populate the list based on the value of another choice list during run-time.

Subject: setting uitable cell choice list during run-time

From: Tom Dakin

Date: 7 May, 2010 05:30:25

Message: 2 of 5

I am having a similar issue. That is, I need to access the uitable choice lists during run time. Did you ever resolve your problem? If so how?

Subject: setting uitable cell choice list during run-time

From: us

Date: 7 May, 2010 09:06:04

Message: 3 of 5

"Tom Dakin" <tom@appliedmicrosystems.com> wrote in message <hs08hh$rsu$1@fred.mathworks.com>...
> I am having a similar issue. That is, I need to access the uitable choice lists during run time. Did you ever resolve your problem? If so how?

one of the solutions is outlined below

% create a test function, eg, UT.M, with content
function uh=utbl
     uh=uitable(gcf,...
          'data',num2cell(magic(3)),...
          'cellselectioncallback',@ut_sel_cb);
end
function ut_sel_cb(h,e)
     c=get(h,'data');
     set(h,'userdata',c{e.Indices(1),e.Indices(2)});
     disp(get(h,'userdata')); % <- remove this later...
end

% at the command prompt
     uh=ut;
% click on a cell, eg, [2,3]
% 7 % <- in the command window from the DISP command...
     csel=get(uh,'userdata');
% csel = 7

us

Subject: setting uitable cell choice list during run-time

From: Tom Dakin

Date: 8 May, 2010 03:52:03

Message: 4 of 5

Not quite the problem I am trying to resolve.
What I need to do is access and modify the choice list for each cell in a uitable that was generated in guide.
I have 80 cells in one uitable that each have a choice list with 30 choices. What I want to do is add an additional choice (I.e. 30->31 choices) and update the choice list of all 80 cells.

Thanks for the amazingly fast reply though.

Subject: setting uitable cell choice list during run-time

From: Tom Dakin

Date: 8 May, 2010 05:25:38

Message: 5 of 5

Sorry, there is an error in my last post. I need to modify each cell's choice list independently. I.e. not every cell in the uitable has the same choice list.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
choice list upd... Tom Dakin 7 May, 2010 23:54:06
graphics handle us 7 May, 2010 05:09:09
callback us 7 May, 2010 05:09:09
code us 7 May, 2010 05:09:09
uitable Tom Dakin 7 May, 2010 01:34:31
choice list Tom Dakin 7 May, 2010 01:34:31
run time B. Schmidt 11 Sep, 2009 10:09:05
choice list B. Schmidt 11 Sep, 2009 10:09:05
uitable B. Schmidt 11 Sep, 2009 10:09:05
rssFeed for this Thread

Contact us at files@mathworks.com