Returning an array element in an array of strings The string array classRoster is a row array of string scalars with the student names. The array entry corresponds to the seat number of the student. Write a function that returns the name of the student in the seat given the string array classRoster and the seat number. Ex: classRoster=["Jill Applegate"; "John Monroe"; "Cristian Phillips"]; studentName = StudentLookup(classRoster, 2) returns studentName = "John Monroe" Function function studentName = StudentLookup(classRoster, seatPosition) studentName = 'FIXME'; end Code to call your function StudentLookup(["Megan"; "Greg"; "Jacob"; "Tony"], 3)
Added by Blanca S.
Close
Step 1
We need to access the element in the classRoster array that corresponds to the seatPosition. We can do this using indexing: classRoster(seatPosition). Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 63 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write Matlab code without using any built-in functions to return the determinant of a 4x4 matrix
Sri K.
Write the MATLAB functions function [l,u]=LUnopivot(a) that returns the LU factorization of A, obtained by Gauss Elimination without pivoting. Test your routine for the matrices A in the previous problem above, using matrix multiplication. Use the routine, together with the routines function x=utrisol(u,b) and function x=ltrisol(l,b) written earlier to solve the systems in the previous problem.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD