evaluate dynamic variables in a loop and assign each one with optimvar.
Ältere Kommentare anzeigen
Hi;
i created a number of variables like the following:
for j=1:N
eval(['b' num2str(j) '= j']);
end
i need to assign each b1,b2,b3,.... as the following inside the loop.
b1=optimvar('b1','Type','integer','LowerBound',0,'UpperBound',1);
b2=optimvar('b2','Type','integer','LowerBound',0,'UpperBound',1);
.
.
.
please help.
4 Kommentare
Walter Roberson
am 26 Jun. 2019
Matt and I are unlikely to help you debug optimization code you have written that way.
mohammad alquraan
am 26 Jun. 2019
Walter Roberson
am 26 Jun. 2019
Cell array, or dynamic field names on a struct array.
mohammad alquraan
am 26 Jun. 2019
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!