Filter löschen
Filter löschen

for loops.

2 Ansichten (letzte 30 Tage)
God'sSon
God'sSon am 31 Mär. 2011
Hello! Please, how can I implement an iteration, such that a first loop executes a series of expressions within a range of (32) values and a second loop executes a series of expressions within another range of(16) values for each result of the first iteration. the result of this would be 512 iterations. Thank u.
  1 Kommentar
Walter Roberson
Walter Roberson am 31 Mär. 2011
Are the values independent or does the first loop need to complete before the second loop could start?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

the cyclist
the cyclist am 31 Mär. 2011
I guess you mean nested loops?
for ni=1:32
for nj=1:16
% Do something here?
end
end
  4 Kommentare
Walter Roberson
Walter Roberson am 31 Mär. 2011
parfor ni=1:32
%do first thing here
end
parfor ni=1:32
for nj=1:16
%do second thing here
end
end
It would, though, not surprise me if the first parfor would be more efficient as a for loop -- depends how much work is done in the first part.
God'sSon
God'sSon am 31 Mär. 2011
I did away with the parfor loops and got it running using only for-loops in all the cases.
Thanks u very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by