Alternative method needed for a few 'for' loops inside each other
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I have 4 for loops inside each other as seen here:
for A=1:a
for B=1:b
for C=1:c
for D=1:d
do_something (A,B,C,D)
end
end
end
end
The values of A, B, C, D are dependent on each other so I can't calculate them separately. The issue is that this is extremely slow. Could anyone please help me with an alternative fast method? Thank you very much for your time and help.
0 Kommentare
Antworten (1)
Jan
am 8 Mär. 2015
No. It is impossible to give a useful suggestion based on this abstract code. The problem is not the nested loops, but the code hidden behind "do_something". The explanation "A, B, C, D are dependent" does not allow to understand the underlying concept.
The profiler helps to identify teh bottlenecks of the program. Use it and post the corresponding code in a less simplified manner. Then a helpful suggestion is possible.
4 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!