finding same array elements and working out basic arithmatics with loops

6 views (last 30 days)
hey guys Im writing a code to compute some basic arithmetics. I have a matrix D consisting out of 12 columns. the first thing I do is some basic arithmatics: PLa=column 9 - column 8 Futhermore,i want the code to look for the same elements in a column, say 7, then compute the following. PLb=column 9-colum 8. With that I substract PL1 from PL2, so PL=PLb-PLa.
For every element in column 7, I would like to do the same thing.
I came up with the next code if true
% code
load D.mat;
fL1 = 1575.42 ;
fL2 = 1227.60;
L1 = D(:,8);
L2 = D(:,9);
dt=1;
satn=D(:,7);
PLa = [];
%time interval for the time derivative of geometery-free combination of %phase observations (for each satellite)
for i = 1:1 %length(D(:,8))
PLa(i) = L2(i)-L1(i);
for j = 1:length(D(:,7))
%satn = satn(j)
if satn(i)==satn(j)
PLb(j)=L2(j)-L1(j);
PL(end+1) = PLb(j)-PLa(i);
end
end
end
end
what I get in PL is the wrong difference values and only for one of the values of column 7. (when calculating it manually)

Answers (0)

Community Treasure Hunt

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

Start Hunting!