How do I increment "I" more than once in more than one range in a single for loop? Basically combine all for loops into a single loop with different "I" values.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
for I = 6611:6648
R = TempDev.Vias(I).R;
xx = TempDev.Vias(I).xc+R*cos(phi);
yy = TempDev.Vias(I).yc+R*sin(phi);
hfssCylinder2(fid, "ViaSub" + num2str(I), 'Z', [ViasX(I), ViasY(I), 0], R, hsubstrate, Units, Nsides);
hfssCylinder2(fid, "Via" + num2str(I), 'Z', [ViasX(I), ViasY(I), -hmicrostrip], R, hsubstrate, Units, Nsides);
hfssCylinder2(fid, "ViaSub" + num2str(I+6648), 'Z', [-ViasX(I), ViasY(I), 0], R, hsubstrate+hmicrostrip*2, Units, Nsides);
hfssCylinder2(fid, "Via" + num2str(I+6648), 'Z', [-ViasX(I), ViasY(I), -hmicrostrip], R, hsubstrate+hmicrostrip*2, Units, Nsides);
end
for I = 6195:6375
R = TempDev.Vias(I).R;
xx = TempDev.Vias(I).xc+R*cos(phi);
yy = TempDev.Vias(I).yc+R*sin(phi);
hfssCylinder2(fid, "ViaSub" + num2str(I), 'Z', [ViasX(I), ViasY(I), 0], R, hsubstrate, Units, Nsides);
hfssCylinder2(fid, "Via" + num2str(I), 'Z', [ViasX(I), ViasY(I), -hmicrostrip], R, hsubstrate, Units, Nsides);
hfssCylinder2(fid, "ViaSub" + num2str(I+6375), 'Z', [-ViasX(I), ViasY(I), 0], R, hsubstrate+hmicrostrip*2, Units, Nsides);
hfssCylinder2(fid, "Via" + num2str(I+6375), 'Z', [-ViasX(I), ViasY(I), -hmicrostrip], R, hsubstrate+hmicrostrip*2, Units, Nsides);
end
for I = 6131:6162
R = TempDev.Vias(I).R;
xx = TempDev.Vias(I).xc+R*cos(phi);
yy = TempDev.Vias(I).yc+R*sin(phi);
hfssCylinder2(fid, "ViaSub" + num2str(I), 'Z', [ViasX(I), ViasY(I), 0], R, hsubstrate, Units, Nsides);
hfssCylinder2(fid, "Via" + num2str(I), 'Z', [ViasX(I), ViasY(I), -hmicrostrip], R, hsubstrate, Units, Nsides);
hfssCylinder2(fid, "ViaSub" + num2str(I+6162), 'Z', [-ViasX(I), ViasY(I), 0], R, hsubstrate+hmicrostrip*2, Units, Nsides);
hfssCylinder2(fid, "Via" + num2str(I+6162), 'Z', [-ViasX(I), ViasY(I), -hmicrostrip], R, hsubstrate+hmicrostrip*2, Units, Nsides);
end
0 Commenti
Risposte (1)
Steven Lord
il 15 Set 2020
for k = [1:9 10:10:90 100:100:1000]
fprintf("The current value of k is " + k + newline)
end
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!