How to save function outputs as a vector to workspace.
이전 댓글 표시
function [A B] = coconuts( a, b, c)
the function will run many times, each time outputting a unique A & B. How can I save each A & B output into a corresponding (N,1) vector that is available in the workspace?
Thank you.
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2014년 7월 30일
for k=1:N
[A(k) B(k)] = coconuts( a, b, c);
end
댓글 수: 1
Ikenna Okoye
2018년 8월 31일
It works nicely, but is there a way to increment the k=1:N? I wrote a code for an atmospheric model and I need to plot the output of the function and I'm varying it from 1km to 100km by 1km increments. I would appreciate your help!
카테고리
도움말 센터 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!