Decision Branching, modification Script

51 Ansichten (letzte 30 Tage)
Francis Adams Kwofie
Francis Adams Kwofie am 5 Jul. 2021
Bearbeitet: PUJA am 20 Apr. 2024 um 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 Kommentare
bhuvan lekkala
bhuvan lekkala am 10 Nov. 2021
this is correct
Muhammad Mansoor khan
Muhammad Mansoor khan am 7 Sep. 2022
Reenter this code
if doPlot == 1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Melden Sie sich an, um zu kommentieren.

Antworten (9)

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

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

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

Melden Sie sich an, um zu kommentieren.


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

Thameemul Ansari Kaja
Thameemul Ansari Kaja am 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 am 30 Mär. 2022
if doPlot==1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

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

Hashim Albasher
Hashim Albasher am 1 Feb. 2023
if doPlot == 1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end

Hojiboy
Hojiboy am 15 Mai 2023
if doPlot == 1
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
end
  2 Kommentare
Niklas
Niklas am 12 Sep. 2023
All answers above will lead to:
Test Results:
Incorrect!
When doPlot is 0, did you not plot the data?
PUJA
PUJA am 20 Apr. 2024 um 9:56
Bearbeitet: PUJA am 20 Apr. 2024 um 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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by