why cant i click my checkbox in UItable?
2 views (last 30 days)
Show older comments
sachin narain
on 20 Apr 2018
Commented: sachin narain
on 22 Apr 2018
I have made a UItable in matlab Guide but i am not able to work with my checkbox.
And another problem is,i have created only 6 columns but why do i get 8 columns with my code.Kindly help me with this.I am attaching my code i have made and also a photo of the table i prepared.
function TerrainGUI_v2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to TerrainGUI_v2 (see VARARGIN)
type_environment ={'Segm', 'Arc' ,'Circuit', 'Intersection' ,'Round', 'Spline'};
type_Location ={'City', 'Country' ,'Highway'};
slope = [{''}];
len_Portions = [{''} {''} slope];
radius_Portions = [{''}];
authorised ={f} ;
tabledata =[type_environment(1) type_Location(1) len_Portions slope radius_Portions authorised]; be added that if i add a straight line i should disable the radius of portions
Column_to_affect = 5;
tabledata (:,Column_to_affect) = cellfun(@num2str, tabledata(:,Column_to_affect), 'uniform', 0);
columnname ={'Environment','Location','Length of Portions','Slope','Radius of portions','Authorised'};
columnformat = {type_environment,type_Location,'numeric','numeric','numeric','logical'};
columneditable = [true true true true true false] ;
set(handles.table_Tracks,'ColumnName',columnname,'Data',tabledata,'ColumnFormat', columnformat,'ColumnEditable', columneditable,'RowName',[],'BackgroundColor',[.7 .9 .8],'ForegroundColor',[0 0 0] );
% Choose default command line output for TerrainGUI_v2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
2 Comments
Walter Roberson
on 20 Apr 2018
Edited: Walter Roberson
on 20 Apr 2018
What is f ?
You need a comment symbol before the "be added that if"
Accepted Answer
Walter Roberson
on 20 Apr 2018
slope = [{''}];
so slope is a cell array with one entry that is an empty character vector
len_Portions = [{''} {''} slope];
so len_Portions is a cell array with two empty character vectors followed by the content of slope that is one empty character vector, making len_Portions a cell array with three empty character vectors
tabledata =[type_environment(1) type_Location(1) len_Portions slope radius_Portions authorised]; be added that if i add a straight line i should disable the radius of portions
type_environment(1) is one entry
type_location(1) is the second entry, so total 2 after the end of it
len_Portions is the next three entries, so total 5 after the end of it
slope is the next entry, so total 6 after the end of it
radius_Portions is the next entry, so total 7 after the end of it
authorized is the next (and last) entry, so total 8 after the end of it
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!