accessing and writing for loop for struct array

조회 수: 13 (최근 30일)
Özge Bozkurt
Özge Bozkurt 2016년 11월 5일
답변: KSSV 2016년 11월 5일
ı have created a struct array with 3 level student.name student.score student.letter
ı have the information of the name and the scores of the students but ı have to write a for loop to assıgn letter grades (a-f) to as a third field. Howver, ı cannot reach into the struct of the array, what can I do?

채택된 답변

KSSV
KSSV 2016년 11월 5일
Let there be 5 students with the below grades.
grades = {'a' 'c' 'e' 'f' 'b'} ;
for i = 1:length(student)
student(i) = grades{i} ;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by