MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Any unspecified fields for new structs in the array contain empty arrays.

patient(3).name = 'New Name';
patient(3)

ans = struct with fields:
name: 'New Name'
billing: []
test: []

Access data in the structure array to find how much the first patient owes, and to create a
bar graph of his test results.

amount_due = patient(1).billing

amount_due = 127

bar(patient(1).test)
title(['Test Results for ', patient(1).name])

11 Structures

Free download pdf