I am new to AppDesigner, but I watched many tutorials and went throught the examples. I am attempting to build my first application and I have not been able to troubleshoot this issue. The goal is to have a 5 column table that the user can populate with the relevant information. I Intended the user to be able to add text to the last column as a description or comment to the row. See the picture below. Adding the number of rows works fine, but I have not gotten to Add or Delete or Edit Row yet.
The user can add entries to the five entries, and then click Replace Row and it should populate the row number based on this code (copied from Code View in AppDesigner):
% Button pushed function: ReplaceRowButton
function ReplaceRowButtonPushed(app, event) % Finding Manually Entered Numbers after Button is pressed
rn = app.RowNumberAddEdit.Value; t = app.ThicknessEditField.Value; n = app.nEditField.Value; k = app.kEditField.Value; d = app.DescriptionEditField.Value; app.UITable.Data(rn,2) = t; app.UITable.Data(rn,3) = n; app.UITable.Data(rn,4) = k; app.UITable.Data(rn,5) = d; end end
Now, printing variable d in the Command Window gives whatever is typed, for example 'Air', but then it won't add it to the table. I have tried assigning column formatting, using differemt functions, everything results in an error. Anything from NaN, to inserting a random number, to errors like this:
Unable to perform assignment because the size of the left side is 1-by-1
and the size of the right side is 1-by-3.
Error in Table/ReplaceRowButtonPushed (line 59)
app.UITable.Data(rn,5) = d;
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 382)
Error while evaluating Button PrivateButtonPushedFcn.
It is clear that I am missing something. Any guidance would be appreciated!
Best Answer