Ask Question
19 September, 09:50

Write a single statement that shifts row array attendanceValues one position to the left. The rightmost element in shiftedValues also keeps its value.

Ex: [10, 20, 30, 40] after shifting becomes [20, 30, 40, 40]

+2
Answers (1)
  1. 19 September, 10:16
    0
    Hi, you haven't provided the programing language in which you need the code, I'll just explain how to do it using Matlab, and you can apply a similar method for any programming language.

    Answer:

    attendanceValues = [attendanceValues (2:end), attendanceValues (end) ]

    Explanation step by step:

    We take all the values of the array from the second position until the end, in this case, we use attendanceValues (2:end) for that. We take the last value of the array using attendanceValues (end). We create a single array based on the result of step one plus step two. We save the new array in the old one reusing attendanceValues.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a single statement that shifts row array attendanceValues one position to the left. The rightmost element in shiftedValues also keeps ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers