for p=1:5
S0=[0.1 0.2 0.3 0.4 0.5];
D0=[2.1 2.2 2.3 2.4 2.5];
for rep1=length(S0(p))
for rep2=length(D0(p));
Sr=S0(rep1);
Du=D0(rep2);
end
end
I need to evaluate the below condition. How can i change the above code.
S0 1st value & D0 1st value;
S0 2nd value & D0 2nd value;
S0 3rd value & D0 3rd value;
S0 4th value & D0 4th value;
S0 5th value & D0 5th value.

 採用された回答

Stephen23
Stephen23 2019 年 1 月 31 日

0 投票

S0 = [0.1,0.2,0.3,0.4,0.5];
D0 = [2.1,2.2,2.3,2.4,2.5];
for k = 1:numel(S0)
Sr = S0(k);
Du = D0(k);
... the rest of your code
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by