Stepping over / removing duplicate points

1 view (last 30 days)
Jay
Jay on 8 Apr 2015
If I want to populate B with derived values from Matrix A using the following specifiers how could I do this?
Point 1 = 800 (A(1,1))
I then want to populate the B matrix (1,1) with the first point 2 value.
The observation equation would be B(1,1) = A(1,1) + A(1,3)
I then want to run through the B matrix using that elements value + the corresponding element in A(:,3), ie the B matrix element position to look for the same value throughout A. See further down for further explanation.
Counter_1 = 1
Counter_2=1
Row_count = 1
m = 1
To_specifier = 1
Delete_count =1
Del_from_B =1
Val = 1
for Counter_1 = 1:7
for Counter_2 = 1:10
if A(Row_count,2) == Val
B(To_specifier ,1) = A(1,1) + A(Row_count,4)
s=s+1
A(Row_count,2) = 0 % used to show what code is doing throughout breakpoints.
else if A(Row_count,2) == Val +1 % point #2
B(A(Row_count,3) = B(s-1,1) + A(Row_count,4)
A(Row_count,2) = 0
end
val = val+1 % want to then peruse the next point value in increasing sequence.
I want to also put a subroutine in the code so that if there is a value in element B that element number (position of element and not value inside it), will be removed from all of the A(:,3) thus removing any duplicate calculations for that point.
A=
800 1 2 4.3
NaN 2 4 3.6
NaN 3 6 2.1
NaN 4 3 4.8
NaN 5 7 11.1
NaN 6 3 -12
NaN 6 5 -4
NaN 1 4 -17
NaN 2 5 -15
NaN 3 6 -7
B = zeros (1:6)

Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!