how to avoid writing a script for every input again
1 次查看(过去 30 天)
显示 更早的评论
I have a series of species and I need to get a matrix of each component using a for loop. I have to repeat the code for each species, though it does not seem to be a sensible way. I tried to use for loop to avoid the repetition but the thing is for loop replace the previous ones.
2 个评论
James Tursa
2018-3-6
The general advice here would be to write a function that contains the code common to the processing you need to do.
KSSV
2018-3-7
Write your code into a function......call the code and store the value for every loop. Show us your code..we will help you.
回答(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!