replacing the for loop please
Mostra commenti meno recenti
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 Commenti
pg
il 9 Ago 2017
Image Analyst
il 9 Ago 2017
What does "large" mean to you? Like 1000, or 100 million? What are typical values for L and numPT?
pg
il 9 Ago 2017
"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:
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!