How can I store the output from a function to the workspace ?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
Help me to store the obtained output (minDist) in the workspace. You will find enclosed the function tsp_ga.m that I use.
Thanks in advance.
댓글 수: 2
채택된 답변
Stephen23
2017년 11월 15일
편집: Stephen23
2017년 11월 15일
The function tsp_ga returns a structure with lots of values in it. minDist is one of those values:
S = tsp_ga(...)
S.minDist
Or inside your loop:
if kk=1:5
S = tsp_ga(...);
ss(kk) = S.minDist;
end
This is explained quite well inside the function help, with both calling syntax and examples. You should read the help of every function that you use, because the help shows you how to use that function, and means that you do not have to guess and waste your time asking random strangers on the internet for help.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!