I have to import text file and then find the centroid value of the matrix
Afficher commentaires plus anciens
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
1 commentaire
Walter Roberson
le 14 Mai 2013
Isn't this really the same matter as your other question http://www.mathworks.co.uk/matlabcentral/answers/75752-matrix-centroid-finding-using-data-in-a-text-file ? If so then you should post it there and delete this question.
Réponses (0)
Catégories
En savoir plus sur Data Import and Export dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!