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 views (last 30 days)
Show older comments
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 Comments
Answers (1)
See Also
Categories
Find more on Logical 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!