Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (35 Points) Theater seat search Create a Theater seat search program in MATLAB. The people assigned to each seat is represented by a random

image text in transcribed

2. (35 Points) Theater seat search Create a Theater seat search program in MATLAB. The people assigned to each seat is represented by a random integer number between 1 and 100. The theater is a rectangular space with 5 rows and 10 columns. Your program will determine in which row and columna person is located. For this, define a function in MATLAB that receives the value person_id. Inside your function you will define 2 variables: row_i and col with the value of 0. Define your theater as a random matrix using the MATLAB function randil) with the appropriate parameters. Using 2 loops move through the rows and columns of your matrix comparing if the person_id matches with the id of the person in that seat. If it matches you will update row_i and col variables with the corresponding position. If the person_id is not found in the theater the function should return row_i = 0 and colj = 0 The same person_id in multiple seats is allowed in this program, so report the last appearance of the values, like in your searchNumber() function example. function crow_i, col_j1 - theaterSeat (person_id) 2. (35 Points) Theater seat search Create a Theater seat search program in MATLAB. The people assigned to each seat is represented by a random integer number between 1 and 100. The theater is a rectangular space with 5 rows and 10 columns. Your program will determine in which row and columna person is located. For this, define a function in MATLAB that receives the value person_id. Inside your function you will define 2 variables: row_i and col with the value of 0. Define your theater as a random matrix using the MATLAB function randil) with the appropriate parameters. Using 2 loops move through the rows and columns of your matrix comparing if the person_id matches with the id of the person in that seat. If it matches you will update row_i and col variables with the corresponding position. If the person_id is not found in the theater the function should return row_i = 0 and colj = 0 The same person_id in multiple seats is allowed in this program, so report the last appearance of the values, like in your searchNumber() function example. function crow_i, col_j1 - theaterSeat (person_id)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago

Question

Guidelines for Informative Speeches?

Answered: 1 week ago