Azzera filtri
Azzera filtri

&&の使い方がわからない

97 visualizzazioni (ultimi 30 giorni)
恵輔 沖
恵輔 沖 il 5 Apr 2023
Modificato: Atsushi Ueno il 25 Mag 2023
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 の部分の意味を教えていただきたいです。
よろしくお願いします。

Risposte (1)

Kohei Ikeda
Kohei Ikeda il 5 Apr 2023
Modificato: Kohei Ikeda il 5 Apr 2023
if x > L/2 && temp(n - 1, 1) < L/2
この部分は2つの条件がどちらも満たしているか判定しています。
日本語でそれっぽく表現すると、
"xがL/2よりも大きい かつ temp(n - 1, 1)がL/2よりも小さい場合、"
といった文章になり、&&はこの文章において"かつ"を意味しています。
詳しいことが知りたい場合、公式ドキュメントの MATLAB の演算子と特殊文や、 Short-Circuit AND, &&を読んでみるとよいかもしれません、
  1 Commento
恵輔 沖
恵輔 沖 il 25 Mag 2023
ありがとうございます。

Accedi per commentare.

Categorie

Scopri di più su Logical in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!