Adding UITable row data which consists of numbers and strings
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Eyad
el 1 de Nov. de 2022
Comentada: Eyad
el 1 de Nov. de 2022
As the title suggests, I am designing an app in App Designer, which has a table called app.UITable, and I am trying to add rows to the table as added below, then I recieve an error which is also added below. (please help)
Error:
Values within a cell array must be numeric, logical, or char"
Code:
% Code that executes after component creation
function startupFcn(app)
app.UITable.Data = {
0,0,0,"Consumption (kWh)";
0,0,0,"Consumption (RM)";
0,0,0,"ICPT (-RM0.02 per kWh)";
0,0,0,"ST";
0,0,0,"Current Month Consumption (RM)";
0,0,0,"Current Bill (RM)"
};
end
1 comentario
Robert
el 1 de Nov. de 2022
Hi,this should do the job. Each line in the cell is a line in the table.
app.UITable.ColumnName = {"Consumption (kWh)";...
"Consumption (RM)";...
"ICPT (-RM0.02 per kWh)";...
"ST" ;...
"Current Month Consumption (RM)";...
"Current Bill (RM)";
}
app.UITable.Data = {1 2 3 4 5 6; 7 9 10 11 12 13;}
Respuesta aceptada
Cris LaPierre
el 1 de Nov. de 2022
I'd suggest using cell2table to turn your cell array into a table.
app.UITable.Data = cell2table({0,0,0,"Consumption (kWh)";
0,0,0,"Consumption (RM)";
0,0,0,"ICPT (-RM0.02 per kWh)";
0,0,0,"ST";
0,0,0,"Current Month Consumption (RM)";
0,0,0,"Current Bill (RM)"
})
Más respuestas (0)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer 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!