Creating table with array in element
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Philip Shaw
el 2 de Jun. de 2021
Comentada: Walter Roberson
el 2 de Jun. de 2021
I am trying to create a table which includes an array in each row (like the output from regionprops etc.)
I know how to do it by creating a struct and using struct2table, but is there are way to create a blank table with an array variable using the table('Size', [..], 'VariableTypes', ...) constructor?
I have tried searching but any useful results are buried under posts about array2table.
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Jun. de 2021
You do not need to do anything special. Once the variable exists, you can write over the content with an array
t = table('Size', [3 2], 'VariableTypes', {'uint8', 'double'})
t.Var2 = zeros(3, 2)
The only challenge would be to have a variable created in the table to have an initial size that has multiple columns; there is no provision for doing that as one step (other than calling table() and passing in content of the appropriate size.)
2 comentarios
Walter Roberson
el 2 de Jun. de 2021
You can see that regionpops does it by using cell() for the multi-row entries.
img = imread('cameraman.tif');
bw = img > 224;
imshow(bw)
props = regionprops('table', bw, 'area', 'centroid', 'extrema')
varfun(@class, props)
Más respuestas (0)
Ver también
Categorías
Más información sobre LaTeX 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!
