How to sum a specific column in the UI Table Component using MATLAB App designer?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kyle Ramphal
el 25 de Mzo. de 2022
Respondida: Kevin Holly
el 4 de Abr. de 2022
How to calcualate the sum of a specified column with a UI table Componment in MATLAB Appdesinger. The UI table is integrated with the struct function to store the data. Please see the attached code file to see the approached taken. Firstly the user enters the two values by clicking the submit button and storing it into the UI table. The user then should beable to press the display button to see the total of a specific colum when chosen from the drop down menu component. Any assistance would be appreciated.
0 comentarios
Respuesta aceptada
Kevin Holly
el 4 de Abr. de 2022
Please see the edited app attached.
I changed the following functions:
function tablefcn(app)
% d2struct = struct('num',app.num1,'num2',app.num2);
% dg1 = struct2cell(d2struct);
app.UITable.Data = [app.t1;[app.num1,app.num2]];%dg1'];
app.t1 = app.UITable.Data;
end
function sumvalue1(app) % function to sum the columns
app.total = sum(app.t1);
app.TotalEditField.Value= app.total(1);
end
function sumvalue2(app)
app.total = sum(app.t1);
app.TotalEditField.Value= app.total(2);
end
I also deleted a space in your dropdown box for 'Value 1', it was 'Value 1 '. The space was causing the case to not be identified.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!