Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Row aray gameScoreinal arsontet arow ayghrs thar cenains al payer scoes prester

ID: 3887942 • Letter: R

Question

Row aray gameScoreinal arsontet arow ayghrs thar cenains al payer scoes prester than min-Scone Hint: meetsThreshold is a logic array that cates which elements in gameS Ex If gameScores is 12. 5, 7,61.9.1] and minScore is 5, then highScores should be 17.8, 9 Save Reset MATLAB Documentation Your unction 1function highScores GetHighScores (ganescores, minScore) 21% ganescores: Array contains all player scores 31% minScore: Scores greater than minscore are added to highscores neetsThreshold (gamescores > ninScore); % Logic array indicates which % elements are greater than ninScore construct a row array highscores containing all player scores greater than ninScore highscores = 0; 11 end Code to call your function C Reset 1GetHighScores([2, 5, 7, 6, 1, 9, 1], 5) Run Function Assessment Submit Check if GetHighScores ([2,5,7,6,1,9,1],5) returns [7,6,9 Check if GetHighScores([2, 8, 11], 10) returns [11]

Explanation / Answer

GetHighScores.m file

function highScores = GetHighScores(gameScores,minScore)
% get elements greater than minScore and add to highScores
% gameScores > minScore returns a boolean array, gameScores(gameScores > minScore) returns values if boolean array value is 1
highScores = gameScores(gameScores > minScore);

main.m file

GetHighScores([2,5,6,1],2)

% output [5 6]