Getting input user data from an ui table..
3 ビュー (過去 30 日間)
古いコメントを表示
Hey guys Im having the same problem.. Storing data from an uitable.. The problem isnt to get the data at the begging but when the user inpus his own changes.. when i close the figure data is lost while it is located within the function. is there any other way so i can get the new data before closing the window? This is my code:
function InsertInput_Callback(hObject, eventdata, handles) % hObject handle to InsertInput (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % global Data % FE Input nelm=str2num(get(handles.nelm, 'String')); Thr_el=str2num(get(handles.Thr_el, 'String')); Lamin=str2num(get(handles.Lamin, 'String')); Elmnodes=str2num(get(handles.Elmnodes, 'String')); % Geometric Input Length=str2num(get(handles.Length, 'String')); Width=str2num(get(handles.Width, 'String')); Thick=str2num(get(handles.Thick, 'String'));
%% Creates Figure for the tables Fig = figure('Position',[500 300 2.5*Thr_el*150 400],'numbertitle','off','MenuBar','none');
%% Creates Table to Insert Materials
selector=cell(1,Thr_el); Col_Name=cell(1,Thr_el);%'Select Mat';%'Select Mat'; defaultData1 = repmat( {'Select Material',} , 1, Thr_el); FontSize=10;
for iselect=1:Thr_el selector{1,iselect}={'Aluminum';'Composite';'Other'}'; Col_Name{1,iselect}=sprintf('D_layer_%d_Mat' ,iselect); end columnformat = selector ; % x y width height Mat_Table = uitable('Parent', Fig, 'Position', [0 0 (Thr_el+1)*140 50], ... 'Data', defaultData1, 'RowName', 'Material', ... 'ColumnEditable', true, 'ColumnWidth', {110}, 'FontSize', FontSize, ... 'ColumnFormat', columnformat, 'ColumnName', Col_Name');
%% Creates Table to Insert Lamination
defaultData2 = repmat( {'Give Lamination',} , Thr_el, Lamin);
Row_Name=cell(1,Thr_el); for i_name_lamin=1:Thr_el Row_Name{1,i_name_lamin}=sprintf('D_layer_%d_Lamination' ,i_name_lamin); end
Lam_Table = uitable('Parent', Fig, 'Position', [0 50 (Lamin+1)*150 Thr_el*FontSize*3], ... 'Data', defaultData2, 'ColumnEditable', true, 'ColumnWidth', {100}, ... 'FontSize', FontSize, 'RowName', Row_Name');
%% Creates Table to Insert D Layer Thickness
Col_Name=cell(1,Thr_el); defaultData3 = repmat( {'Thickness',} , 1, Thr_el);
for iselect=1:Thr_el Col_Name{1,iselect}=sprintf('D_layer_%d_Thick' ,iselect); end % x y width height Thick_Table = uitable('Parent', Fig, 'Position', [(Thr_el+1)*110 0 (Thr_el+1)*140 50], ... 'Data', defaultData3, 'RowName', 'DLayer Thickness', 'ColumnEditable', true, ... 'ColumnWidth', {100}, 'FontSize', FontSize, 'ColumnName', Col_Name');
1 件のコメント
Geoff Hayes
2014 年 9 月 30 日
Please format the above code so that it is readable. Highlight the code portions and press the {} Code button. Else, just attach the code as an m or text file to your question using the paperclip button.
What do you want to do with the new data as you close the figure/GUI? Save the data to file or to the workspace or..?
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!