Calling a function multiple times in a for loop.
15 ビュー (過去 30 日間)
古いコメントを表示
Waseem AL Aqqad
2020 年 10 月 21 日
コメント済み: Waseem AL Aqqad
2020 年 10 月 21 日
Hi,
I'm calling my function
function psiA=test_M(rmv)
multiple times, and I'm passing different input arguments each time.
rmv=[1 2 4 5 7 8];
psi=zeros(1,length(rmv));
for k = 1 :length(rmv)
psi=test_M(rmv(k));
end
The size of the output in each iteration should be 1x1, and at the end of for loop, it should be a vector of size 1x6.
In each iteration the output of previous iteration is set to zero, I don't know why.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387078/image.png)
Below is the last line of my function
psiA(1,rmv)= sizesB(1)/Nodes;
Your help would be greatly appreciated!
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!