Borrar filtros
Borrar filtros

how to make a perfect table

3 visualizaciones (últimos 30 días)
reza hamzeh
reza hamzeh el 30 de Nov. de 2019
Editada: Adam Danz el 30 de Nov. de 2019
hi. i wanted to descripe some info of a pic as a table. but i have some problems here.
1- i dont want number in braket. for example i want [1] change to 1
2- how can i show the info of Centroid and BoundingBox columns?
3-how can i put borders for the table?
clear;
I = imread('rice.png');
bw=imbinarize(I);
[labeled,numobjects]=bwlabel(bw,4);
numobjects;
labeledprops=regionprops(labeled,'basic');
for i=1:numobjects
row{i}=i;
area{i}=labeledprops(i).Area;
centroid{i}=labeledprops(i).Centroid;
boundingbox{i}=labeledprops(i).BoundingBox;
end
C_row=row';C_area=area';C_centroid=centroid';C_boundingbox=boundingbox';
T = table(C_row,C_area,C_centroid,C_boundingbox)
T.Properties.VariableNames = {'row' 'Area' 'Centroid' 'BoundingBox'}
table.jpg

Respuesta aceptada

Adam Danz
Adam Danz el 30 de Nov. de 2019
Editada: Adam Danz el 30 de Nov. de 2019
The idea is to convert your cell arrays to tall matrices or column vectors. That could be done prior to entering the values into table() or it can be done as you enter the values into table() (shown below).
T = table([C_row{:}].',[C_area{:}].',cell2mat(C_centroid),cell2mat(C_boundingbox));
T.Properties.VariableNames = {'row' 'Area' 'Centroid' 'BoundingBox'}
View results
head(T)
ans =
8×4 table
row Area Centroid BoundingBox
___ ____ ________________ ______________________________
1 145 5.9448 35.028 0.5 21.5 13 23
2 127 6.4803 62.087 0.5 52.5 13 17
3 71 2.1408 85.099 0.5 72.5 4 24
4 187 4.615 117.65 0.5 102.5 10 29
5 160 9.4563 141.29 0.5 132.5 20 16
6 86 4.0581 179.23 0.5 170.5 8 15
7 182 11.758 205.15 0.5 199.5 23 11
8 60 6.3833 222.33 0.5 218.5 15 9

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by