sdpvar as a cell - error message!

42 views
Skip to first unread message

Salamino15

unread,
Apr 5, 2015, 9:34:09 PM4/5/15
to yal...@googlegroups.com
Hi,

I am using the CELLFUN function => A = CELLFUN(FUN, C) which applies the FUN function to the contents of cell/cell array C, and returns the results in A.

The objective function is as follows, where x is an sdpvar variable:

obj = obj + cellfun(str2func(char(ArrayUF(i))),{forecasted_power(i)})  - cellfun(str2func(char(ArrayUF(i))),{x(i)});

I get the error below. Would you please help me solve this! Thanks :)

??? Error using ==> cellfun
sdpvar output type is not currently implemented.

Error in ==> opt at 40
    obj = obj +
    cellfun(str2func(char(ArrayUF(i))),{forecasted_power(i)})  -
    cellfun(str2func(char(ArrayUF(i))),{x(i)});

Johan Löfberg

unread,
Apr 6, 2015, 2:59:04 AM4/6/15
to yal...@googlegroups.com
You cannot use cellfun on sdpvar objects

Salamino15

unread,
Apr 6, 2015, 4:43:50 PM4/6/15
to yal...@googlegroups.com
Thanks!

Any idea how to work around this? Casting maybe? A similar function to cellfun in YALMIP where I can use function handles?

:)

Johan Löfberg

unread,
Apr 7, 2015, 1:47:34 AM4/7/15
to yal...@googlegroups.com
Write your own cellfun replacement (it's just a for-loop)

Reply all
Reply to author
Forward
0 new messages