Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: Using textscan function properly
Posted:
Jan 15, 2012 2:13 PM
|
|
On Jan 15, 8:53 pm, TideMan <mul...@gmail.com> wrote: > On Jan 13, 9:39 pm, Avri Alony <avrial...@gmail.com> wrote: > > > > > > > > > > > I have xml files which contain the follows lines: > > <I x="12508.2645" y="0.0425" /> > > <I x="12509.04" y="0.072928" /> > > <I x="12509.8" y="0.06485" /> > > <I x="12510.63909" y="0.078086" /> > > ... etc > > I would like to generate two matrix X and Y that will contain the > > values. > > i.e: X = [12508.2645 ; 12509.04 ; 12509.8 ; 12510.63909] > > and Y = [0.0425 ; 0.072928 ; 0.06485 ; 0.078086] > > > Is it possible to do so without the use of for loop? > > > One more problem is the fact that the files contains header. > > > Thanks > > For reading .xml files, you can use xml2struct from the file exchange. > IMHO, this is a better way than mucking around with textscan.
Thank you both but using xml2struct or for loop is too long function, I have 100,000 files (!!) to parse and I need to find the faster way to do so. I'm believe that textscan is the faster one. the only problem is to force the function to read only the relevant data and skip the header wich night have different length from file to file.
|
|
|
|