Taking user input from table in GUI
显示 更早的评论
Hello,
Sorry for the long post. I have this GUI, I am working on in this gui. I have this table

I made this table using these lines:
Boundary_Position = 0;
AssemblyData4 = {0, 0};
AssemblyTable4 = uitable (f, 'Units' , ' centimeters' , 'Position' , [13,0,5,5], 'Data' , AssemblyData4, 'ColumnEditable' , [true, true], 'ColumnName' , { ' Nodes / mm ' ; ' Boundary ' }, ' CellEditCallback ' , {@ AssemblyEdit_Callback4});
Now to put data in the table,
I am using this loop
for TempIndex2 = 1: size (GlobalMesh, 2)
AssemblyData4 (TempIndex2,1) = num2cell (GlobalMesh (1, TempIndex2));
AssemblyData4 {TempIndex2,2} = 0;
end
set (AssemblyTable4, 'Data' , AssemblyData4);
Global Mesh is the list of nodes, after I enter data, the picture looks like this

After this the user enters the value in the bounary column, and the picture becomes

To save this data from the user, the code I am using is
function AssemblyEdit_Callback4 (source, eventdata, handles)
for TempIndex3 = 1: size (GlobalMesh, 2)
Boundary_Position (TempIndex3) = AssemblyData4 {TempIndex3,2};
% Boundary_Position (TempIndex3) = get (handles.AssemblyTable4, 'data');
end
end
Boundary_Position is a global variable.
The problm I am having is that no data is being stored in the variable Boundary_Position. It is empty
Does anyone know what could be changed or how it can be done?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!