Hello,
Suppose I have two Matrices A & B
>> A=[1 2 5;7 11 12;15 17 19]
A =
1 2 5 7 11 12 15 17 19
>> B=[2 4 6;10 12 14;16 19 22]
B =
2 4 6 10 12 14 16 19 22
I have a variable say (c) that I will obtain it's value from other commands and used it to find which element in matrix A that equal to it's value.
for example c=2
This means I have to locate the element in Matrix A that =2, which is A(1,2).
Then I want to add a number say (Num=1) to original value of A(1,2) and the elements that follows this elements (i.e. from A(1,3) to A(3,3)), Also I want to add the same number to Matrix B for the elements from B(1,3) to B(3,3), without B(1,2).
How to that?
The Expected Result are:
A =
1 3 6 8 12 13 16 18 20
B =
2 4 7 11 13 15 17 20 23
I am thinking of something like this, but it is totally not correct
A(find(A==c))=Original_Value+Num
B(find(A==c))=Original_Value+Num %Stating from B(1,3) not from B(1,2) as A
Thank you in-advance
Alaa
Best Answer