## Matlab Question

MATLAB interface, C API, using plugins, other interfaces

### Matlab Question

Hallo
I would really like to ask for your help as I am new in Matlab.
I have a Matrix b=[5 8 10 2 3 7 8 6 3 10]
And c=2*b
What I would like to do is the following:
I would like the values of c that are greater than 7 (in this case 7 values).
From these values of c that are greater than 7 I want to keep one (any of these) equal to 7 (so reducing the value exactly to 7) by converting matrix b.
So basically I would like to transform matrix b in order to get one value of c,which is greater than 7, equal to 7 and the rest ,that are greater than 7, less than seven
I would really appreciate any help
Thank you!
georgio_211

Posts: 2
Joined: Sun Feb 28, 2010 10:37 pm

### Re: Matlab Question

The following code should work for you to get values of c greater than 7:
Code: Select all
`b=[5 8 10 2 3 7 8 6 3 10]c=2*bnewValues = c(find(c>7))`

I'm not following the rest of your question.
space_egd

Posts: 357
Joined: Sun Jun 08, 2008 9:02 pm
Location: MD

### Re: Matlab Question

space_egd wrote:The following code should work for you to get values of c greater than 7:
Code: Select all
`b=[5 8 10 2 3 7 8 6 3 10]c=2*bnewValues = c(find(c>7))`

I'm not following the rest of your question.

Thank you very much for your help.

The next part is of the question is the following:
Matrix c has 7 values that are greater than 7.
From these seven values I want to keep only one (any of them)
the rest that are greater than seven I want to reduce them to become less than 7.
In order to achieve this the code has to reduce the corresponding values of b.
For example if c=[10 16 20 4 6 14 16 12 6 20] I want it to become eg c=[6 7 5 4 6 6 5 5 6 6.5] basically only one above 7 (From those that already are above 7)!
I was thinking like a for loop with i equal to the size of the matrix and which will have to update the values of b at the end but I am stack
georgio_211

Posts: 2
Joined: Sun Feb 28, 2010 10:37 pm

### Re: Matlab Question

What is the end goal of this matrix manipulation?
Will you be ingesting the results into GMAT?
space_egd

Posts: 357
Joined: Sun Jun 08, 2008 9:02 pm
Location: MD