loop

1 Ansicht (letzte 30 Tage)
Mate 2u am 18 Jun. 2012
Hi I need to do two loops, where the inputs of both need to be 0.4:0.01:0.99, any help on how to achieve this buy by still going through the conventionally i=1: etc (as need this for output).
1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Kevin Holst am 18 Jun. 2012
could you try to describe this a little better, maybe with some of your own code in it. I'm assuming that:
for i = 0.4:0.01:0.99
end
...will not work for you.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson am 18 Jun. 2012
KVals = 0.4:0.01:0.99;
for K = 1 : length(KVals)
thisval = KVals(K);
...
end
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Thomas am 18 Jun. 2012
You could try something like
ii=0.4:0.01:0.99;
for count1 =1:length(ii)
for count2=1:length(ii)
output(count1,count2)= something
ii(count1) and ii(count 2) % these are the variable that you can use and the values in ii
end
end
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

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