Count numbers from 0 to a value input by the user in uitable
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Kim Lopez
el 16 de Oct. de 2017
Respondida: Jan
el 16 de Oct. de 2017
Assuming the user input a value which is 8. Then display the result in column from 0 to 8 as shown on the image.
0 comentarios
Respuesta aceptada
Jan
el 16 de Oct. de 2017
n = input('Number of rows: ');
Data = cell(n+1, 3);
Data(:,1) = num2cell((0:n).');
f = figure;
t = uitable(f);
t.ColumnName = {'User Input', 'Capacity Available', 'Probability'};
t.ColumnEditable = [false, true, true];
t.Data = Data;
0 comentarios
Más respuestas (1)
Walter Roberson
el 16 de Oct. de 2017
uitable, use a Data cell array with three columns, and configure the column names and column types.
2 comentarios
Walter Roberson
el 16 de Oct. de 2017
There are a number of ways to put data into a cell array, including a plain "for" loop.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!