How to save "optimoptions" to a file?

조회 수: 4 (최근 30일)
MByk
MByk 2020년 9월 14일
댓글: Star Strider 2020년 9월 14일
Is there a way to save "optimoptions" to a txt file? I tried the code below but it is not working. I also tried "dlmwrite" and "writetable". Thanks for the help.
fid = fopen('GA_Results.txt','wt+');
fprintf(fid,'%s', GA_Opts);
fclose(fid);

채택된 답변

Star Strider
Star Strider 2020년 9월 14일
I have never tried that.
I would save it to a .mat file. Then load it when you need it.
  댓글 수: 4
MByk
MByk 2020년 9월 14일
편집: MByk 2020년 9월 14일
That's exactly the same error I got but using "save" command and saving to a mat file works perfectly. You can save both variables (GA results and optimoptions) in one call. There is also an example with txt files in the document page, it is working but it is impossible to read the txt file.
save('GA_Results.mat','GA_Opts','GA_Results')
Star Strider
Star Strider 2020년 9월 14일
Thank you!
For some problems .mat files are the only option.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by