Function Sort to find smallest value in a Column?

조회 수: 3 (최근 30일)
Alessandro
Alessandro 2016년 2월 25일
댓글: dpb 2016년 2월 25일
I'm trying to find the five smallest value corresponding to their exact date from this weekly time series. What I wrote is the following:
tsStocks=fints(DATE, SP500)
Five_smallest_Value=sort(tsStocks,1,'ascend')
And i get this error:
Undefined function 'sort' for input arguments of type 'fints'.
Anyone able to tell me the right way to find them?
Thanks in advance.

답변 (1개)

dpb
dpb 2016년 2월 25일
Don't have Toolbox here so can't try it, but looks like you'll want the sortfts function to deal with a FTSOBJ
  댓글 수: 2
Alessandro
Alessandro 2016년 2월 25일
Now at least I don't get the error as before, but sortfts only help me to sort the date from the oldest to the most recent and not, as I would like, to sort the values from the bigger to the smaller or inverse. Thanks for the help.
dpb
dpb 2016년 2월 25일
From the above doc --
Arguments
tsobj
Financial time series object.
flag
(Optional) Sort order:
flag = 1; increasing order (default)
flag = -1; decreasing order
Of course, even if it didn't have the flag optional argument, simply reversing the increasing order after sorting will produce the decreasing order vector.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by