MATLAB POLYSPACE RELEASE NOTES Uživatelský manuál Strana 157

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 240
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 156
Other Data Structures
end
avg = sum(scores)/(las t - first + 1);
You can run this function using different values for the dynamic field stu den t.
First, initialize the structure that contains scores for a 25-week period:
testscores.Ann_Lane.week(1:25) = ...
[958976827992949289817593...
85 84 83 86 85 90 82 82 84 79 96 88 98];
testscores.William_King.week(1:25) = ...
[878091849987938797878289...
86 82 90 98 75 79 92 84 90 93 84 78 81];
Now run avgscore, supplying the students name fields for the testscores
structure at runtime using dynamic field names:
avgscore(testscores, 'Ann_Lane', 7, 22)
ans =
85.2500
avgscore(testscores, 'William_King', 7, 22)
ans =
87.7500
4-19
Zobrazit stránku 156
1 2 ... 152 153 154 155 156 157 158 159 160 161 162 ... 239 240

Komentáře k této Příručce

Žádné komentáře