How to delete the second struct from 2x1 (non-scalar)struct?

thank you for checking my Q first!
the struct is output in my case. it is in the loop, so at each iteration the row varies ( like 1x1, 2x1). but i just want to have the first row only (1x1) since i want to form table from each iteration.
any help please.

4 Comments

upload your code with all the necessary details
for k= 1:100
imageFile =strcat('image', num2str(k), '.jpg'); % to import file
imageData =imread(imageFile);
grayImage= rgb2gray(imageData); % convert rgb file to gray
bw= imbinarize(grayImage,0.9);
s = regionprops( bw, 'centroid', ...
'MajorAxisLength', 'MinorAxisLength');
T(k,:)= struct2table(s);
center= s.Centroid;
x(k)= center(1);
y(k)= center(2);
% [center, radii] = imfindcircles(bw,[Rmax Rmin],'ObjectPolarity','dark');
diameters = mean([s.MajorAxisLength s.MinorAxisLength],2);
radii = diameters / 2;
% hold on
% viscircles(center,radii);
% hold off
end
you forgot to upload your image file
i could only upload 1 image.i dont know how to upload 2 ,3 images. anyhow for the iteration upto k=37, the struct is 1x1, when k=38, i end up having 2x1 struct
thank you!

Sign in to comment.

Answers (1)

Categories

Asked:

on 11 Nov 2018

Edited:

on 11 Nov 2018

Community Treasure Hunt

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

Start Hunting!