I have to import text file and then find the centroid value of the matrix

This is the code I wrote but it doesn't rum Please help me
for n = 1:5
data=['C:\Users\sunayana.chakradhar\Documents\MATLAB\Ascii12\f',num2str(n),'.txt'];
I= dlmread(data);
I=mean(I);
X_sum=sum(I,1); % sum of every column
Y_sum=sum(I,2); % sum of every row
X=1:120; % number of elements in x i
Y=1:120; % number of elements in y j
centX=sum((I(X,Y)*X_sum))/sum(I(X,Y));
disp centX
end

Answers (0)

Categories

Asked:

any
on 14 May 2013

Community Treasure Hunt

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

Start Hunting!