Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

how to store the intermediate result when using fmincon

Asked by xueqi

xueqi

on 30 Jan 2013

Dear fellows, I am using fmincon to do optmization. Could you tell me how to look at and store the intermediate result when fmincon is trying different value? Well, I need to give an initial value for fmincon to start, and after that, it will try different value to find the optimized one. I want to check all those values that it tried and the corresponding results. Cheers

0 Comments

xueqi

xueqi

Tags

Products

No products are associated with this question.

3 Answers

Answer by Shashank Prasanna

Shashank Prasanna

on 30 Jan 2013
Accepted answer

You can use OutputFcn to access values at each iteration.

See the following link for more information:

http://www.mathworks.com/help/optim/ug/output-functions.html

In the optionset you can use the function as below:

options = optimset('OutputFcn',@outfun)

9 Comments

xueqi

xueqi

on 5 Feb 2013

Sorry it is final out not final input

Shashank Prasanna

Shashank Prasanna

on 5 Feb 2013

I am not sure I follow you. I don't want the final output.

Just run your optimization and and even if it is stuck at an iteration, can you please paste what is on the screen? If you post it in the forum there may be other who may be able to help you better. If you don't provide enough information, no one will be able to help you.

xueqi

xueqi

on 5 Feb 2013

It needs to read in data in excel file. I can I also put into excel file here? Thanks!

Shashank Prasanna

Shashank Prasanna

Answer by xueqi

xueqi

on 5 Feb 2013

It needs to read in data in excel file. I can I also put into excel file here? Thanks!

0 Comments

xueqi

xueqi

Answer by Alan Weiss

Alan Weiss

on 5 Feb 2013

Use the xlswrite function to export data to an Excel file.

Alan Weiss

MATLAB mathematical toolbox documentation

0 Comments

Alan Weiss

Alan Weiss

Contact us