## picking maximum difference across entries of row vectors, Part 2

### alpedhuez (view profile)

on 6 Jun 2018
Latest activity Edited by Stephen Cobeldick

### Stephen Cobeldick (view profile)

on 6 Jun 2018
Now A is a table with the first column has the date data. (not a variale)
for each row, take a difference between every possible pair of two elements in the row and returns the maximum difference
In a simpler case where A is a matrix, if A= [1 3 6 7 10], then B=[9].

#### 1 Comment

Stephen Cobeldick

on 6 Jun 2018

### Aakash Deep (view profile)

on 6 Jun 2018

Hello,
In order to find out the maximum difference between two elements in a row vector, you can first sort it and then take the difference between the last and the first element.
vec = sort(A);
B = vec(end)-vec(1);
Hope this helps :)

alpedhuez

### alpedhuez (view profile)

on 6 Jun 2018
The point is that they are in a table, not in a matrix.
Stephen Cobeldick

### Stephen Cobeldick (view profile)

on 6 Jun 2018
@alpedhuez: If you post a follow-up question please put a link to the original question. It helps us to keep track of what information or answers you have already been given, and what extra clarifications or data you have given us about the question.
alpedhuez

### alpedhuez (view profile)

on 6 Jun 2018
Thank you for letting me know.