Hi Abdullah,
The challenge you are facing arises when the new results are added to the table without preserving the existing data, resulting in the current content being overwritten. To address this, kindly ensure that you retrieve the current data from the table before incorporating any new entries.
For guidance on updating the table while maintaining the existing data, please refer to the documentation and code provided below.
% txt1 is the textfield1, txt2 is textfiled2 and tb1 is table
function onButtonPushed(txt1, txt2, tbl)
% Get the numbers from text boxes
num1 = txt1.Value;
num2 = txt2.Value;
% Combine the numbers as a string
combinedStr = sprintf('%d%d', num1, num2);
% Get the current row index from UserData
currentRow = tbl.UserData;
% Get current data from the table
currentData = tbl.Data;
% Ensure the table has enough rows
if size(currentData, 1) < currentRow
currentData{currentRow, 1} = combinedStr;
else
currentData{end+1, 1} = combinedStr;
end
% Update the table data
tbl.Data = currentData;
% Increment the row index for the next entry
tbl.UserData = currentRow + 1;
end