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 portionsColumn_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);
Best Answer
so slope is a cell array with one entry that is an empty character vector
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
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