reading files with fields

  • Follow


i have 2 types of files, each with different number of fields. i wanna read the whole line in each file and put it in a struct.

i want that the process of struct building will be dynamic - i'm reading the fields name and this will be the struct fields 


[tree, RootName, DOMnode]=xml_read('Hospital.map');  % read whole XML file
%% read walls/room
dataLength=length(tree.Walls.Room); %number of lines
fieldQuantity=length(fieldnames(tree.Walls.Room(1).ATTRIBUTE)); %number of fields

FieldNames=fieldnames(tree.Walls.Room(1).ATTRIBUTE);

for i=1: fieldQuantity
    points(dataLength).FieldNames(i)=0;
end

but withthis code i get struct with only one field -  points.FieldNames
how to change the code so i'll get the fields listed in FieldNames
0
Reply michael 4/30/2010 5:37:04 AM


0 Replies
294 Views

(page loaded in 0.102 seconds)

Similiar Articles:













7/23/2012 7:26:43 AM


Reply: