MATLAB: Taking user input from table in GUI

arrayfor loopguimatlab 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?

Best Answer

I solved it.
function AssemblyEdit_Callback4(source, eventdata, handles)
Boundary_Position= get(AssemblyTable4, 'data');
display(Boundary_Position)
end
A single line of code......no for loop