MATLAB: Do I get an Invalid_Security error when I use the function portfolio

bloombergFinancial Toolboxportfolio

I am using "portfolio" to try to pull portfolio information from an Active Bloomberg API, but I am getting an error that says 'Invalid_Security'.
Here is my code:
c = blp
p = 'NameOfPortfolio'
f = {'PORTFOLIO_MEMBERS','PORTFOLIO_MPOSITION','PORTFOLIO_MWEIGHT','PORTFOLIO_DATA'}
d = portfolio(c,p,f)
And the output is:
ERROR: {'INVALID_SECURITY'}
PORTFOLIO_MEMBERS: {{0×1 cell}}
PORTFOLIO_MPOSITION: {{0×1 cell}}
PORTFOLIO_MWEIGHT: {{0×1 cell}}
PORTFOLIO_DATA: {{0×1 cell}}

Best Answer

When using "portfolio", the 'p' value should be the 'id' of the portfolio (as listed in your Bloomberg terminal), followed by the keyword 'Client', not the name of the portfolio.
For example, if the portfolio's id is U482919-3, you should put
p = 'U482919-3 Client';