MATLAB:我们有数据给出出现的x y坐标。通常在一个位置上有多于1个出现。当我们想在函数pdist中使用这些数据时,这会产生问题。我们试图将数据更改为具有x y坐标的列表,用于EACH出现,但到目前为止尚未管理。有人有解决方案吗?
% initial values m = 0;
[X,Y,People,Positive] = textread('Loaloa_data.txt', '%f%f%f%f', 'headerlines', 1);
LoaData = [X,Y,People, Positive];
%calculate percentage of infected people per location
Percentage_per_Location = (Positive(:)./People(:))*100;
%calculate percentage of total infected people per location
TotPos = sum(Positive);
Percentage_of_Total = Positive(:)./TotPos*100;
LoaData = [X,Y,People,Positive,Percentage_per_Location, Percentage_of_Total];
%Make a new frequency table in which every value of Positive has a x and y
%value.
% first make a new matrix with x and y coordinated and positive values.
LengthColumn = (1:197)';
Matrix1 = [LengthColumn,X,Y,Positive];
Freq = zeros(sum(Positive(:)),2) ;
% r = Matrix1(:,1)
% CumFreq = ([1: sum(Positives)]);
% Freq = Matrix1(:,4);
% xyData =zeros(length(Freq),2);
for i=1:length(Matrix1(:,1))
%for m<=TotPos
F = Matrix1(i,4)
for j =[1:F]
m = m+j
Freq(m,1:2) = Matrix1(i,2:3)
end
% end
end