Concatenate rows into a table using a for loop with app designer
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ratanjot
el 9 de Feb. de 2023
Respondida: Sulaymon Eshkabilov
el 10 de Feb. de 2023
Here I have an app designer call back function where when the user selects 'Instant Charge' in the drop down menu and clicks the button, it will output all the values (a,b) in a table. Going from row to row, I am having trouble with concatenating a new row to the table. The code is set up in a for loop so that it indexes the value in array a and array b but once that row is outputted in the table, I would like the next index of a and b values to be stored in the second row of the table, and so on. In this example, there are about 300 rows that need to be added to the table. May I get some assistance with concatenating new rows to the same table. Thank you for your help.
0 comentarios
Respuesta aceptada
Sulaymon Eshkabilov
el 10 de Feb. de 2023
Note that if you need to update the content of the table, then you should use one of these approaches:
(1) Update the table:
A = randi([-10, 10], 3, 1);
B = table(A);
for ii = 1:10
B.A(ii+3) = randi([-10, 10],1);
end
B
(2) Update the table:
% OR
K = [];
M = table(K);
for ii = 1:10
M{ii,:} = randi([-10, 10],1);
end
M
(3) Concatenate the tables with the same variable name:
P = randi([-10, 10],1);
W = table(P);
for jj = 1:5
P = (randi([-10,10],1));
U = table(P);
W = [W; U];
end
W
1 comentario
Más respuestas (1)
Sulaymon Eshkabilov
el 10 de Feb. de 2023
Maybe you can try this approach:
for jj=1:5
for ii = 1:10
M(jj,ii) = randi([-10, 10],1);
end
end
M_tab = array2table(M)
0 comentarios
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!