Asked by xander
Please help. I've made the variable for in_vector, but I'm having trouble figuring out how to get the vector to return a row vector of num_or_digits of length 10.
Write a script that takes a vector of single-digit integers and counts the occurrences of each digit, from 0 to 9, in the vector. Your script takes a vector in_vector of arbitrary length which contains single-digit integers and returns a row vector num_of_digits of length 10. Here, the k-th entry in num_of_digits should contain the number of occurrences in in_vector of digit (k-1). For example, the number of zeros in in_vector would be listed as the first entry in num_of_digits, and so on. If in_vector is [0,0,1,3,2] then num_of_digits should be [2,1,1,1,0,0,0,0,0,0].
Caution : Do not use more than one loop.
Write a script that takes a vector of single-digit integers and counts the occurrences of each digit, from 0 to 9, in the vector. Your script takes a vector in_vector of arbitrary length which contains single-digit integers and returns a row vector num_of_digits of length 10. Here, the k-th entry in num_of_digits should contain the number of occurrences in in_vector of digit (k-1). For example, the number of zeros in in_vector would be listed as the first entry in num_of_digits, and so on. If in_vector is [0,0,1,3,2] then num_of_digits should be [2,1,1,1,0,0,0,0,0,0].
Caution : Do not use more than one loop.
Answers
There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.