Clear Filters
Clear Filters

For Loop help condensing a matrix

1 view (last 30 days)
Julianna
Julianna on 28 Oct 2020
Commented: David Hill on 28 Oct 2020
Hello.
I created a large array called Hist that is (160x6) with my number of iterations over the length is in the 1st column. When a variable nSpans is equal to 4, I would be trying to pull out four specific lengths: L(1) - 1, L(2) - 1, L(3) - 1, and L(4) - 1, and what each other column is equal to in the rows that these occur.
Example, row 40 is where L(1) - 1 occurs and is shown below:
10.0000 2 -11.0714 -10.7143 0.2375 0.0030
How would I write a for loop for n=1:nSpans to do this? I basically just want to condense my Hist matrix to be (nSpans,6).
Let my know if anyone needs more information. Cheers.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!