How to perform Indexing

1 vue (au cours des 30 derniers jours)
Larissa Aissata Diarra
Larissa Aissata Diarra le 18 Jan 2020
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 commentaire
James Tursa
James Tursa le 18 Jan 2020
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.

Connectez-vous pour commenter.

Réponses (1)

Athul Prakash
Athul Prakash le 21 Jan 2020
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:

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by