MATLAB: I have a variable ‘a’ that contains x and y coordinate values as 365.5 and 213.5 .How can i read them to an array or matrix. ??

matrix array

I2=imread('filename.jpg') originalImage = I2; originalImage = rgb2gray(originalImage); subplot(3,1,1); blobMeasurements = regionprops(labeledImage, originalImage,'EulerNumber', 'Centroid'); numberOfBlobs = size(blobMeasurements, 1); for blobNumber = 1 : numberOfBlobs thisBlobsEulerNumber = int32(blobMeasurements(blobNumber).EulerNumber); % Get list of pixels in current blob. numberOfHoles = int32(1 – thisBlobsEulerNumber); blobCentroid = blobMeasurements(blobNumber).Centroid; if blobNumber==1 a=blobCentroid; else b=blobCentroid; end

Best Answer

Your variable "a" is already a matrix, one of size 1 by 2. You can use a(1) and a(2) to access the parts.