- 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 view (last 30 days)
Show older comments
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 Comments
Stephen23
on 9 Oct 2019
Edited: Stephen23
on 9 Oct 2019
"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.
Accepted Answer
Stephen23
on 9 Oct 2019
Edited: Stephen23
on 9 Oct 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on Data Preprocessing 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!