Decision Branching, modification Script

51 vues (au cours des 30 derniers jours)
Francis Adams Kwofie
Francis Adams Kwofie le 5 Juil 2021
Modifié(e) : PUJA le 20 Avr 2024 à 10:01
Modify the script so that the plotting code on lines 4-7 are executed only when doPlot is 1.
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
  2 commentaires
bhuvan lekkala
bhuvan lekkala le 10 Nov 2021
this is correct
Muhammad Mansoor khan
Muhammad Mansoor khan le 7 Sep 2022
Reenter this code
if doPlot == 1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Connectez-vous pour commenter.

Réponses (9)

Dhruv G
Dhruv G le 5 Juil 2021
if doPlot
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

KAPIL DEV YADAV
KAPIL DEV YADAV le 10 Juin 2022
if doPlot==1
plot(5,8)
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Manisha Sonewane
Manisha Sonewane le 29 Sep 2021
If doPlot==1 %%plotting code; end
  1 commentaire
bhuvan lekkala
bhuvan lekkala le 10 Nov 2021
this is wrong and its shows errors and its just a hint

Connectez-vous pour commenter.


Harshada Pawar
Harshada Pawar le 9 Jan 2022
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")

Thameemul Ansari Kaja
Thameemul Ansari Kaja le 17 Jan 2022
if doPlot==1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Samuel Kwesi Tandoh
Samuel Kwesi Tandoh le 30 Mar 2022
if doPlot==1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

chaymae saibari
chaymae saibari le 3 Avr 2022
if doPlot==1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Hashim Albasher
Hashim Albasher le 1 Fév 2023
if doPlot == 1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Hojiboy
Hojiboy le 15 Mai 2023
if doPlot == 1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end
  2 commentaires
Niklas
Niklas le 12 Sep 2023
All answers above will lead to:
Test Results:
Incorrect!
When doPlot is 0, did you not plot the data?
PUJA
PUJA le 20 Avr 2024 à 9:56
Modifié(e) : PUJA le 20 Avr 2024 à 10:01
Modify the script so that the plotting code on lines 5-8 execute only if doPlot is 1.
Answer:
if doPlot == 1
x=5
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Connectez-vous pour commenter.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by