&&の使い方がわからない
97 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nn = 9
for n = 1:1:Nn
x = temp(n, 1);
D = temp(n, 2); % m
t = temp(n, 3); % m
if x > L/2 && temp(n - 1, 1) < L/2
temp2(a, 1) = L/2;
temp2(a, 2) = D;
temp2(a, 3) = t;
Nc = a;
a = a + 1;
else
end
temp2(a, 1) = x;
temp2(a, 2) = D;
temp2(a, 3) = t;
a = a + 1;
end
この if x > L/2 && temp(n - 1, 1) < L/2 の部分の意味を教えていただきたいです。
よろしくお願いします。
0 commentaires
Réponses (1)
Kohei Ikeda
le 5 Avr 2023
Modifié(e) : Kohei Ikeda
le 5 Avr 2023
if x > L/2 && temp(n - 1, 1) < L/2
この部分は2つの条件がどちらも満たしているか判定しています。
日本語でそれっぽく表現すると、
"xがL/2よりも大きい かつ temp(n - 1, 1)がL/2よりも小さい場合、"
といった文章になり、&&はこの文章において"かつ"を意味しています。
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!