Effacer les filtres
Effacer les filtres

How do i add a new column to an already created uitable in matlab Guide?

20 vues (au cours des 30 derniers jours)
sachin narain
sachin narain le 7 Mai 2018
Commenté : sachin narain le 10 Mai 2018
I have a uitable with 4columns and 4rows.I want to add a 5th column with'columnformat' as 'logical' to the already created uitable. Kindly help me with this. Thank you in advance.I am attaching a created uitable with this question.

Réponse acceptée

Rik
Rik le 7 Mai 2018
As Jan mentioned in this answer, you can just set the Data property with the required array. You can load the current content to a variable, add the column you want, and write it back to the property. After that, you can (re-)specify any setting you would like.
If this answer doesn't solve your problem, please attach your code with the paperclip icon. You should also show the desired end result.
  5 commentaires
Rik
Rik le 10 Mai 2018
You need to edit the ColumnEditable property.
clear handles
handles.f = figure(99);
handles.table_Grounds = uitable(handles.f,...
'Data',num2cell(randi(100,10,3)),...
'Units','Normalized',...
'Position',[0.1 0.1 0.8 0.8]);
data_Grounds = get(handles.table_Grounds,'Data');
data_Grounds(:,end+1)=num2cell(false(10,1)) ;
IsEditable=[false(1,size(data_Grounds,2)-1) true];
set(handles.table_Grounds,'Data',data_Grounds);
set(handles.table_Grounds,'ColumnEditable',IsEditable);
sachin narain
sachin narain le 10 Mai 2018
Thank you so much.That helped

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by