MATLAB Onramp course error

31 Ansichten (letzte 30 Tage)
Mark Oliver
Mark Oliver am 14 Mai 2019
Kommentiert: Vishnu Sood am 15 Okt. 2022
I am running the MATLAB Onramp but it stalls at 11.1 The MATLAB Editor: (2/2) Practice, (71%)
The error is "There was an issue communicating to the MATLAB compute resource". Execution halts at the same place every time.
  5 Kommentare
SIRAJ
SIRAJ am 6 Aug. 2022
its does had any solution plz share it...
Vishnu Sood
Vishnu Sood am 15 Okt. 2022
delete all the previously typed code then copy and paste from sol. space

Melden Sie sich an, um zu kommentieren.

Antworten (4)

Richard Chukwu
Richard Chukwu am 5 Jun. 2019
Same with me. I'm on the fundamentals and I get this error at intervals. Even though my connection is okay.
  2 Kommentare
Laura Jones
Laura Jones am 15 Feb. 2021
I think those features must be broken and no one is bothering to fix them because the course is free.
SIRAJ
SIRAJ am 6 Aug. 2022
frds one solution i got it first delete all initial lines see the solution then type it u definitely get crt answer try it...

Melden Sie sich an, um zu kommentieren.


Mark Oliver
Mark Oliver am 5 Jun. 2019
I restarted my computer and never had the issue again.

KANISH THAKUR
KANISH THAKUR am 10 Jun. 2020
don't use "..." after "element", after finishing the term inside the bracket close it by using semi colon.
  1 Kommentar
mehdi benbraik
mehdi benbraik am 11 Jun. 2020
yes great ; thank you friend , its ok new
if doPlot
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
else
disp("The density of " + element + " is " + density);
end

Melden Sie sich an, um zu kommentieren.


KAMLESH SINGH
KAMLESH SINGH am 30 Apr. 2020
Bearbeitet: Walter Roberson am 16 Feb. 2021
x = rand
if x > 0.5
y = 3
else
y = 4
end
TASKModify the script so that when the if condition is not satisfied, the following line of code is executed:
disp("The density of " + element ...
+ " is " + density)
Hint
See Solution
Reset
Submit
Hint
Modify the if statement to be an if-else statement.
In the else body, use the code as shown above.
Test Results:
Incorrect!----------------------------------------------Why the result is incorrect???? When the code written in Task 1&2 is correct
Are the densities displayed when doPlot is 0?
Are the densities not displayed when doPlot is 1?
Further Practice
WORKSPACE
COMMAND WINDOW
Decision Branching
Instructions are in the task pane to the left. Complete and submit each task one at a time.
Do not edit. This code creates a random number to test the if statement.
doPlot = randi([0 1])
This code loads the data.
load datafile
density = data(:,1);
Task 1 & 2
if doPlot
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
else
disp("The density of" + element ....
+ "is" + density)
end
1
2
3
4
5
6
7
8
9
10
11
12
13
doPlot = 1
decisionBranching.mlx *
  7 Kommentare
Thabiso Johannes Khune
Thabiso Johannes Khune am 6 Aug. 2021
Bearbeitet: Walter Roberson am 6 Aug. 2022
if doPlot
plot(density)
title("Sample Densities")
xticklabels(element)
ylabel("Density (g/cm^3)")
else
disp("The density of " + element + " is " + density);
end
Walter Roberson
Walter Roberson am 6 Aug. 2022
If you are doing the same task as some other people have posted, then you are not supposed to do those lines unless doPlot is 1 . Your code is doing the lines if doPlot is non-zero. For example if doPlot were 2 then the task would require that the lines not be executed.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Downloads finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by