replacing the for loop please
显示 更早的评论
How can I replace the for loops?
L=(length(time)-1);
for q=1:numPT
for h=1:L
x(q,h)=SortDate{q+numPT*(h-1),6};
y(q,h)=SortDate{q+numPT*(h-1),7};
c(q,h)=SortDate{q+numPT*(h-1),5};
end
end
4 个评论
pg
2017-8-9
Image Analyst
2017-8-9
What does "large" mean to you? Like 1000, or 100 million? What are typical values for L and numPT?
pg
2017-8-9
"so it's better with I get replace the for loops"
Why? What is the problem with them?
Loops are not slow. Badly written code is slow, but as you have not shown us much of your code then we don't have enough information to know what changes your code might need, if any. For example, are the output arrays preallocated?. The most useful information for you is contained on this page, and the pages it links to:
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 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!