MATLAB: Compare array and update the array

compare

Student={ 'A';'B';'C'};
marks={100;100;100};
exam name={'D';'A';'C';'B'};
new marks={12;34;23;45};
i want to compare the exam name with the student and if it is the same I want the marks to be updated by the marks already in the new marks

Best Answer

Student={ 'A';'B';'C'};
marks={100;100;100};
exam_name={'D';'A';'C';'B'};
new_marks={12;34;23;45};
[c,ia] = ismember(Student,exam_name) ;
marks1 = new_marks(ia)