The selected content of popup menu created in a column of uitable does not hold
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mus'ab Ahmad
el 8 de Mzo. de 2017
Comentada: Mus'ab Ahmad
el 8 de Mzo. de 2017
I have created a uitable with its last column has a popup menu in each cell. But whenever I select the content of any menu it does not hold (the cell stays blank). The code is
moves = [1:Dynamic_states(c),]';
loads = zeros(size(moves));
strokes = Strokes{c,1}';
start_time = zeros(size(moves));
duration = Durations{c,1}';
mode = {'idle' 'sleep' 'off'};
tabledata =[moves loads strokes start_time duration];
columnname = {'Move #', 'Load kg', 'Strokes mm', 'Start time', 'Duration sec','Mode'};
columnformat = {'char', 'short', 'short', 'short', 'short', mode};
columneditable = [false true true true true true];
handles.Load_Data = uitable('Parent',AppTab,'Units','normalized','Position',[0.5 0.438 0.4913 0.3],'ColumnWidth','auto','Data', tabledata,'ColumnName', columnname,'ColumnFormat', columnformat,'ColumnEditable', columneditable,'RowName',[] ,'BackgroundColor',[.7 .9 .8],'ForegroundColor',[0 0 0]);
Note: The creation of the uitable is inside a for loop so please avoid using functions to solve this problem
3 comentarios
Adam
el 8 de Mzo. de 2017
Ah yes, I see now. I missed the mode line. It's a while since I've created a uitable!
Respuesta aceptada
Jan
el 8 de Mzo. de 2017
Editada: Jan
el 8 de Mzo. de 2017
When I run you code and select an entry in the popup menu, Matlab shows the warning:
Warning: Table data is not editable at this location.
A guess: The Mode is missing in the tabledata. Try this:
mode = {'idle' 'sleep' 'off'};
modedata = cell(size(moves));
modedata(:) = {'idle'}; % Default value
tableValue = num2cell([moves, loads, strokes, start_time, duration]);
tableData = cat(2, tableVlaue, modedata);
Now the popups have default values and can be edited.
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!