Relational operators and row arrays: Run times Construct a row array fastRunTime
ID: 3887947 • Letter: R
Question
Relational operators and row arrays: Run times Construct a row array fastRunTimes containing all elements of run Times equal to or less than 480 seconds. Your Function Save CReset MATLAB Documentation 1 | function fastRunTimes GetTimes(runtimes) 21% runtimes: Array of run tines % construct a row array fastRunTines containing all elements of runines % equal to or less than 480 seconds fastRunTimes = 0; 8 end Code to call your function C Reset 1GetTimes ([5e0, 490, 480, 41e]) Run Function Assessment Submit Check if GetTimes([500, 490, 480, 410]) returns [480, 410] Check if GetTimes([410,420,400, 410]) returns [410,420, 400, 410]Explanation / Answer
GetTimes.m file
function fastRunTimes = GetTimes(runTimes)
% runTimes <= 480 generates boolean vector and runTimes of boolean vector gives only values less or equal to 480
fastRunTimes = runTimes(runTimes<=480);
end
main.m file
GetTimes([500,490,480,410])
GetTimes([410,420,400,410])
% sample output
% ans =
% 480 410
% ans =
% 410 420 400 410