How do I correspond locations in a nested structured array to locations inside of its nest?

1 view (last 30 days)
For example:
patient.name = 'John Doe';
patient.dob = [042557];
patient.date = [040111; 022512];
patient.date.percentages=[ 02 08 09; 23 20 24]
patient.date.notes = ['Treated for diabetic wound ulcer'; 'Treated for obesity and diabetic wound ulcer'];
I want the first value in patient.date to correspond to the three values in patient.date.percentages, and the second value in patient.date to correspond to the next three values. And I want the first patient.date to correspond to the first string in patient.date.notes, etc? For the purpose of adding elements to the end of these arrays (and have them correspond correctly, to draw upon at a later date for patient data?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 27 Feb 2014
patient.name = {'John Doe'};
patient.dob = {042557};
patient.date = {040111; 022512};
patient.percentages={ [02 08 09]; [23 20 24]}
patient.notes = {'Treated for diabetic wound ulcer'; 'Treated for obesity and diabetic wound ulcer'};
  1 Comment
Golnar
Golnar on 27 Feb 2014
Edited: Golnar on 27 Feb 2014
Thank you.
If I have 3 values being outputted from a previous program, saved as variables: 1. exposed_healthy 2. pus 3. necrotic
And I want to add these three values into patient.percentages
And then create a stacked bar graph with the x-axis as the patient.dates and the y-axis as percentages, the stacks being the three values in percentages, is this how to do it?
patient(end+1).percentages=['healthy_exposed', 'pus', 'necrotic'];
figure; bar(1:12, [healthy pus necrotic], 0.5, 'stack');
axis([0 2 0 100]);
title('Chronology of Wound Specifications'); xlabel('Date of Visit'); ylabel('Percentage');
xdat = [040111 022412 [CURRENT DATE]];
legend('Healthy', 'Infection', 'Necrotic');

Sign in to comment.

More Answers (0)

Categories

Find more on Biological and Health Sciences in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!