Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to uniform the format of reading structure/cell in xml file

Subject: How to uniform the format of reading structure/cell in xml file

From: Bruce Heu

Date: 28 Jul, 2012 16:58:09

Message: 1 of 1

in the xml file, if the data is like this
<Project>
<A At1="1" At2="2" />
</Project>

To get At1, the format of data retrieving is
Project.A.Attributes.At1
and it can't be
Project.A{1,1}.Attributes.At1

If the xml is like

<Project>
<A ID="1" At1="1" At2="2" />
<A ID="2" At1="1" At2="3" />
</Project>

To get the At1, I need to have code like Project.A{1,1 or 2}.Attributes.At1.

So for data with undeterminant length for A, I will need to first determine the length of the data and use "if" to apply different retrieving code for data of different length, =1 or >1.

How can use uniform code, so that for data length=1, the code would be something like
Project.A{1,iData}.Attributes.At1. where iData == 1
and if data length >1, the code would be
Project.A{1,iData}.Attributes.At1. where iData could >1

Thanks...
 

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us