How can I get this simple gui to allow the user to input data into a table, then save that input once they close the window?
3 次查看(过去 30 天)
显示 更早的评论
What I'd like to have happen is that the user defines the size of a square matrix (for instance, 2 x 2). Then a new window would pop up and ask them for the individual data points, and then they would input the values into the correct spots on a table of the right size. I have gotten this to work fine up until the point where I actually need to retrieve the data to be used later. I cannot seem to "save" the data the user inputs. Here is what I have so far:
input = char(inputdlg('Please enter the order of the square matrix you wish to enter:'))
n = str2num(input)
matrix_data = cell(n,n)
matrix_input = figure('MenuBar','none','ToolBar','none',...
'Name','Row Reduction Assistant','NumberTitle','off','Position', [400 350 300 300]);
matrix = uitable(matrix_input,'Data',matrix_data,...
'Position', [42 65 220 220],...
'ColumnEditable',true(1,10),...
'ColumnName',[],...
'ColumnWidth', {30},...
'FontSize', 15,...
'RowName',[]);
waitfor(gcf)
A_data = get(matrix_data,'Data');
When I do this, I get the error message:
Error using get
Conversion to double from cell is not possible.
Error in Test_file (line 14)
A_data = get(matrix_data,'Data');
Please note that what I've got there isn't "neat" as far as GUI's go. I just threw together the basic structure, but I can't seem to figure out how to store the data.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!