Loop confusion while assigning a function to a grid
이전 댓글 표시
First of all i am writing a script that i need for geophysics, simply its a function value for numerous points over a grid.
I have no problem writing the script for my grid and function, but when i want to write a loop to fit my function to different positions along my grid. i get confused and don't know where to start
Basically i want to know how to write a loop to assign my function automatically to all the coordinates on my 11x11 grid
댓글 수: 1
Geoff Hayes
2014년 11월 24일
Amr - what are the inputs to your function? If you are trying to populate an 11x11 grid, are you simply providing the pairs (1,1), (1,2),...,(10,11),(11,11) to your function?
답변 (1개)
Sean de Wolski
2014년 11월 24일
편집: Sean de Wolski
2014년 11월 24일
mygrid = whatever
for ii = 1:numel(mygrid)
Y(ii) = call_my_function(mygrid(ii))
end
카테고리
도움말 센터 및 File Exchange에서 Evaluation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!