- タスク1: doPlotが1の場合はPlot画面が表示され、doPlotが0の場合は何も表示されない
- タスク2: doPlotが1の場合はPlot画面が表示され、doPlotが0の場合は”The density of (省略)”が表示される
13.2 判定分岐 タスク1,タスク2の結果の違いについて
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
佳奈子 浜口
le 14 Juin 2021
Réponse apportée : Atsushi Ueno
le 14 Juin 2021
タスク1とタスク2の結果表示を何処を確認すれば異なるのかがわかりません.
if doPlot
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end
if doPlot
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
else
disp("The density of " + element ...
+
0 commentaires
Réponse acceptée
Atsushi Ueno
le 14 Juin 2021
doPlotが0になる場合と1になる場合の両方をみると違いがわかります。
doPlot = randi([0 1])
を含むタスクを何回か実行し続けて下さい。(セクションの実行ではなく、全体の実行をすればOKです)
繰り返し実行し続けたくなければ、
doPlot = 0 %またはdoPlot=1
に書き換えて実行してください
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur ループと条件付きステートメント 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!