フィルターのクリア

Checkin for equal values in the same column

5 ビュー (過去 30 日間)
Peter Larsen
Peter Larsen 2019 年 2 月 19 日
回答済み: Andrei Bobrov 2019 年 2 月 21 日
Hi
I have a matrix with measured GPS points. Column 1 are the point number, column 2-4 are X,Y,Z coordinates. The first step is to check if the point number is equal to the previous value in column 1. If the point number is the same, then i want to calculate the difference for the X,Y,Z coordinate. How do I do that? I have tried to use a loop, but it doesn't work after my intentions.
Original data:
A=[1 576872.757 6228394.988 3.461;
1 576872.762 6226395.008 3.460;
1 576872.766 6228394.982 3.453;
2 576851.856 6228358.766 3.844;
2 576851.872 6228358.756 3.820.......]
I want the output to look like this:
A=[ 1 0.010 0.027 0.010; %Difference between each coordinate and mean value for each point
1 0.025 0.010 0.035;
1 0.022 0.019 0.049;
2 0.010 0.027 0.038.............]
  3 件のコメント
Peter Larsen
Peter Larsen 2019 年 2 月 21 日
It is corrected now
madhan ravi
madhan ravi 2019 年 2 月 21 日
Now you forgot to add how the original data is.

サインインしてコメントする。

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 2 月 21 日
T = array2table(A);
m = varfun(@mean,T,'GroupingVariables',1);
out = A;
out(:,2:end) = out(:,2:end) - m{A(:,1),3:end};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePulsed Waveforms についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by