- show us the complete error message. This means all of the red text.
- Show us the actual code you re using (currently your code is missing some square brackets, which indicates that some of it is missing.
Need help fixing Vercat error
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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.
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Preprocessing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!