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

1 次查看(过去 30 天)
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?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-2-27
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 个评论
Golnar
Golnar 2014-2-27
编辑:Golnar 2014-2-27
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');

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Biological and Health Sciences 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by