why i cant load data one-by-one into row/column in mat.file

1 view (last 30 days)
why i cant load data one-by-one into row/column in mat.file after sum it in the coding. for example, i run 4 data and i need 4 data to be load in mat.file after sum it one-by-one, but they sum all 4 data together.
%
objMeasurements = regionprops(labeledImage,BW, 'all');
objMeasurements3 = regionprops(labeledImage3, BW, 'all');
objMeasurements2 = regionprops(labeledImage2, BW, 'all');
objMeasurements4 = regionprops(labeledImage4, BW, 'all');
objMeasurementsn = regionprops(labeledImagen, BW, 'all');
numberOfobj = size(objMeasurements, 1);
hold on;
boundaries = bwboundaries(image_dilate);
numberOfBoundaries = size(boundaries);
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2);
end
hold off;
fontSize = 10; % Used to control size of "obj number" labels put atop the image.
labelShiftX = -7; % Used to align the labels in the centers of the coins.
objECD = zeros(1, numberOfobj);
fprintf(1,'Obj # Area Perimeter \n');
for k = 1 : numberOfobj % Loop through all blobs.
% Find the mean of each blob. (R2008a has a better way where you can pass the original image
% directly into regionprops. The way below works for all versions including earlier versions.)
thisobjPixels = objMeasurements(k).PixelIdxList; % Get list of pixels in current blob.
meanGL = mean(BW(thisobjPixels)); % Find mean intensity (in original image!)
meanGL2008a = objMeasurements(k).MeanIntensity; % Mean again, but only for version >= R2008a
objArea = objMeasurements(k).Area; % Get area.
area1=[objArea;area1];
sumarea=sum(area1)
objPerimeter = objMeasurements(k).Perimeter; % Get perimeter.
perimeter1=[objPerimeter;perimeter1];
sumperi=sum(perimeter1)
area_perimeter(i,:)= [sumarea,sumperi];
save('perimeter.mat','area_perimeter');
  2 Comments
Jan
Jan on 16 Oct 2015
I do not understand the question. What is the relevant part of the code? Do you mean "*save* to a .mat file" or "*load* from a .mat file"?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!