0

I am working on a code where the minimum value position is needed. I am trying to code this part inside CVX in the following form

cvx_begin

min_val=val(1);

position=1

for i=1:r 

if val(i) <= min_val

  min_val=val(i)

  position=i

end

cvx_end

However, I receive this error {log-concave} <= {log-concave}.

Is there another way to represent my scalar values and vector to avoid this error?

Dev-iL
  • 23,742
  • 7
  • 57
  • 99
Meriame
  • 11
  • 5
  • The standard way to get the location of the minimum value in MATLAB is to use `[min_val,position] = min(val);`. – Phil Goddard Mar 21 '17 at 17:33
  • Thank you for your help. However, This does not work for CVX – Meriame Mar 21 '17 at 17:38
  • (I'm not an matlab user, but:) this does not even look the slightest like valid cvx code. I'cant even imagine using control-expressions like if & for will ever work like that! Did you consider their docs? Your basic problem (get location of minumum) i would say is not really doable without using integers (->mixed-integer programming). If you would be just interested in the value, not the position, cvx supports that of course. – sascha Mar 21 '17 at 21:42
  • Thank you very much. Well, in term of for loop actually CVX support it perfectly even in constraints as shown here [link] (http://cvxr.com/cvx/doc/advanced.html ). – Meriame Mar 22 '17 at 08:53

0 Answers0