How to resolve an optimization problem related to setpath?

1 回表示 (過去 30 日間)
Cuong
Cuong 2016 年 10 月 5 日
コメント済み: Cuong 2016 年 10 月 5 日
I just copied 100% an example from here: http://www.mathworks.com/help/gads/createoptimproblem.html
anonrosen = @(x)(100*(x(2) - x(1)^2)^2 + (1-x(1))^2); opts = optimoptions(@fmincon,'Algorithm','interior-point'); problem = createOptimProblem('fmincon','x0',randn(2,1),... 'objective',anonrosen,'lb',[-2;-2],'ub',[2;2],... 'options',opts);
However, when I run the codes using Matlab, I got the message " Error using horzcat Dimensions of matrices being concatenated are not consistent.
Error in cell/strcat (line 54) t{i} = [s{:,i}]; "
Then, I type restoredefaultpath, then the example of creating an optimization runs well without any error. However, if I type restoredefaultpath, I can not use some functions that I wrote and put in some folders. I want to optimize those functions use global search. To use those functions, I need to setpath. However, after setting paths to those folders I got the same message above when "createOptimProblem"
Also, I got the same error when trying to save path permanently with "pathdef" issue. I have to set path everytime I run Matlab. The message with pathdef was attached. I tried to google, but no way is successful.
Thanks,

回答 (1 件)

Pritesh Shah
Pritesh Shah 2016 年 10 月 5 日
May be, you don't have admin rights. Put your all codes in current folder.
Try, it may work.
All the best !!
  1 件のコメント
Cuong
Cuong 2016 年 10 月 5 日
I tried different ways (google for answers before asking) but no way works :( so upset

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by