필터 지우기
필터 지우기

How to perform Indexing

조회 수: 1 (최근 30일)
Larissa Aissata Diarra
Larissa Aissata Diarra 2020년 1월 18일
답변: Athul Prakash 2020년 1월 21일
Suppose you wanted to apply the function built in problem 1 to large data sets for salary (All_E_Salaries) & performances (All_E_Performances). You have chosen to do this by calling that function iteratively inside of a for loop.
Modify the script below so that it will perform this iterative operation, and stores the values inside a new vector NewSalaries.
All_E_Salaries= [40000, 40000, 40000, 50000, 50000, 60000]
All_E_Performances = [4, 10, 5, 6, 3, 7]
for i=?? %% Complete this line by replacing the ??'s with the appropriate code.
[NewSalaries(??)] = BonusCalculator(All_E_Salaries(??) ,All_E_Performances(??)); %% Complete this line by replacing the ??'s with the appropriate code.
  댓글 수: 1
James Tursa
James Tursa 2020년 1월 18일
Hints:
numel(variable) gives the number of elements in a vector, which will be useful to you in the for-loop line.
The for-loop variable i can be used to index into your other variables to use only one element.

댓글을 달려면 로그인하십시오.

답변 (1개)

Athul Prakash
Athul Prakash 2020년 1월 21일
Hi Larissa,
The goal of this forum is to help solve generic MATLAB questions, not to provide full solutions to anybody's homework. Having said that, your problem seems very basic as it involves just inserting indices into the given code - I encourage you to figure that out on your own or go through MATLAB On Ramp which is a tutorial on the basics of MATLAB.
Please go through the answers linked below to understand how the community feels about posting your homework here:
MATLAB OnRamp:

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by