필터 지우기
필터 지우기

Need help fixing Vercat error

조회 수: 1 (최근 30일)
Chris H
Chris H 2019년 10월 9일
편집: Stephen23 2019년 10월 9일
load efa_big.mat;
DateStr = datestr('2019-09-04', 'yyyy-mm-dd');
efa = efa_big;
DS_TRADES = ['SELECT DISTINCT '...
'PORTFOLIO, '...
'BUY_SELL_FIX_FLT_NAME, '...
'RUN_DATE, '...
'ISSUER_NAME, '...
'BMK_ISSUER_NAME, '...
'ISSUER_GROUP, '...
'FROM efa '...
'WHERE RUN_DATE(''', DateStr, ''', ''YYYY-MM-DD'') AND '...
'PORTFOLIO = ''Euro Inv'' AND '...
'BUY_SELL_FIX_FLT_NAME = (''Buy'', ''Sell'')'
];
I get the error
"Error using vertcat
Dimensions of arrays being concatenated are not consistent."
What I'm trying to do is in the dataset efa_big I want to pull all the specific column names from line 6-12
DS_TRADES = ['SELECT DISTINCT '...
'PORTFOLIO, '...
'BUY_SELL_FIX_FLT_NAME, '...
'RUN_DATE, '...
'ISSUER_NAME, '...
'BMK_ISSUER_NAME, '...
'ISSUER_GROUP, '...
and filter it for the date range specified, the portfolio name and for all our buys and sells. any idea why I'm getting this error?
'FROM efa '...
'WHERE RUN_DATE(''', DateStr, ''', ''YYYY-MM-DD'') AND '...
'PORTFOLIO = ''Euro Inv'' AND '...
'BUY_SELL_FIX_FLT_NAME = (''Buy'', ''Sell'')'
];
Thanks
  댓글 수: 5
Stephen23
Stephen23 2019년 10월 9일
편집: Stephen23 2019년 10월 9일
"the date in the dataset is numeric so this converts it to an actual date."
That does not explain much, as your code does not use any "datset" as an input to datestr.
What are these lines for? (note that you do not actually use efa anywhere):
load efa_big.mat;
efa = efa_big;
Most likely your DateStr has multiple rows, which will throw that error. But as you provided us with some non-bug-inducing invented data to replace your actual buggy data, we can only guess.
Chris H
Chris H 2019년 10월 9일
편집: Chris H 2019년 10월 9일
yes there are multiple rows for the date. I copied the full code on the very top. Sorry if that was confusing.
As for the dataset it's pulled from our data warehouse and runs daily. I don't have access to the code that pulls the dataset itself. Formatting sometimes needs to be changed to pull what I'm looking for but it's first time I've gotten this error. Eg. a date that's under the column name run_date will be "735934"
If there are multiple rowns, which there are, do you know how I need to change my code to be able to pull a date range?
load efa_big.mat;
efa = efa_big;
Load efa_big.mat is the actual dataset I'm using
I use efa in the line below
'FROM efa '...
That's where I'm pulling everything I need and trying to filter it since it's a very large dataset.

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

채택된 답변

Stephen23
Stephen23 2019년 10월 9일
편집: Stephen23 2019년 10월 9일
This line will cause an error:
% ' '...
If you want to continue to the next line then you need to use an ellipsis, not %, i.e. this works for me:
... % ellipsis works!
The working file, which runs without error, is attached.
I still don't see the point in datestr('2019-09-04', 'yyyy-mm-dd'), which simply returns the character vector '2019-09-04', so you might as well just define that character vector directly.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Portfolio Optimization and Asset Allocation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by