Code not working on my computer, but same file working on my schools computer
5 次查看(过去 30 天)
显示 更早的评论
'optimoptions' requires Optimization Toolbox.
Error in pro1_maingrad (line 14)
options = optimoptions('fmincon','Display','iter','Algorithm','active-set','TolFun',1e-8,'TolCon',1e-7,'SpecifyObjectiveGradient',true,'SpecifyConstraintGradient',true);
[xstar,fstar] = fmincon(@(x)pro1_objgrad(x), x0, [], [], [], [], lb, ub, ...
@(x)pro1_consgrad(x),options);
Above the part of the code I am using for a project. The University and I are both using R2022a, and it I emailed the entire folder of files for this project so I could work on it at home without having to remote in and deal with lag and internet stuff. I remoted in and the same exact code works on their comnputer but not mine. I copied the entire code and pasted it on my local code and it still did not work but still does on the schools computer. Do I have to download soemthing else? Like Simulink or anything else? I do not understand why the code would work on one computer and won't when it was copied to mine.
0 个评论
回答(1 个)
Dyuman Joshi
2023-3-28
编辑:Dyuman Joshi
2023-3-28
As the error states, 'optimoptions' requires Optimization Toolbox. The school's PC has the Optimation Toolbox downloaded, where as your PC does not.
If you have the access to the Optimization Toolbox, you need to download it first. And as your school has access to it, you should have it as well.
To download the toolbox, Click on 'Add-ons' option on Home tab of the toolstrip, which opens a window 'Add-on explorer', type the Toolbox name and download it.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!