Rank: 475 based on 233 downloads (last 30 days) and 3 files submitted
photo

Jaroslaw Tuszynski

E-mail
Company/University
SAIC

Personal Profile:

Professional Interests:

 

Watch this Author's files

 

Files Posted by Jaroslaw View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
26 Jun 2009 Published M-Files xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski data, data import, data export, xmlwrite, tools, xmlread 194 35
  • 4.78261
4.8 | 24 ratings
12 Mar 2007 Published M-Files PhotonAttenuation 2 Provides the attenuation and energy absorption of x-ray and gamma-ray photons in various materials. Author: Jaroslaw Tuszynski physics, photon attenuation, gammaray, mass attenuation coef..., xray, chemistry 25 1
  • 5.0
5.0 | 2 ratings
16 Jun 2006 PhotonAttenuation Function providing the attenuation and energy absorption of x-ray and gamma-ray photons in various Author: Jaroslaw Tuszynski physics, photon attenuation, gammaray, mass attenuation coef..., xray, chemistry 14 1
  • 4.0
4.0 | 3 ratings
Comments and Ratings by Jaroslaw View all
Updated File Comments Rating
22 Jun 2009 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski

Reply to Val Schmidt Comments:

By default xml_read is configured for most common use. If you need performance, DOMnode2struct can be sometimes significantly speeded up if you use Pref.Str2Num='never' and/or trim your output by changing Pref.ReadAttr, Pref.ReadSpec and Pref.NumLevels.

20 May 2009 saveppt2 Save Matlab figure(s) to a PowerPoint Slide Author: Jedediah Frey

great improvement over saveppt . Thanks

Comments and Ratings on Jaroslaw's Files View all
Updated File Comment by Comments Rating
04 Nov 2009 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski Sebastiaan

Mark: have you tried using the Pref.Str2Num=false with xml_read?

02 Nov 2009 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski Weber, Mark

Hi,

I am using your tool very often and I want to thank you for that.

This week I found a little problem and do not knwo how to solve. First of all my xml file:
<measurement>
      <values>
        <value>
          <rssi>-90</rssi>
          <identifier>
            <name>00-11-88-87-F4-82</name>
          </identifier>
        </value>
      </values>
    </measurement>
<measurement>
      <values>
        <value>
          <rssi>-81</rssi>
          <identifier>
            <name>00-11-88-88-42-40</name>
          </identifier>
        </value>
      </values>
    </measurement>

Reading the first part is working, so I get a string called '00-11-88-87-F4-82' with the RSSI value. WIth the second part there is a problem. Because there are only numbers in the string, xmlread does not interpret it as a string. It calcluates the the value of -269. But I need it as String because it is not a number.
How can I solve the problem? Changing the name is not possible because it is given by the application where the xml is coming from.

Thank you in advance.

Kind regards

Mark Weber

31 Oct 2009 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski Ren, Yuan

I think there's some problem in this part:

digits = '[Inf,NaN,pi,\t,\n,\d,\+,\-,\*,\.,e,i, ,E,I,\[,\],\;,\,]';
s = regexprep(str, digits, ''); % remove all the digits and other allowed characters

I found this when one of my LeafNode called "IN" was recognized as "NaN".

I suggest the following modification.

>> regexprep('IN','[Inf,NaN]','')

ans =

     ''

>> regexprep('IN','(Inf)|(NaN)','')

ans =

IN

One other thing is "num = str2num(str)" is a somewhat dangerous function. I'm not sure if it worth it to use this to provide some fancy functionality.

23 Oct 2009 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski Sebastiaan

Hmm, having problems commenting. This is what the question used to be:

VERY nice tool indeed, especially the Pref settings which let you modify the output. However, I have a problem with empty tags or contents. My XML file has lines like this:

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE PD>
<PD version="4.1">
    <Misc>
        <property value="Comments"> </property>
    </Misc>
    <EmptyTag>
    </EmptyTag>
</PD>

Which is read in Matlab as:
tree =
         Misc: [1x1 struct]
     EmptyTag: []
    ATTRIBUTE: [1x1 struct]

tree.Misc.property =
      CONTENT: []
    ATTRIBUTE: [1x1 struct]

So far, so good. However, on writing, the XML file is malformed:
<?xml version="1.0" encoding="UTF-8"?>
<PD version="4.1">
    <Misc>
        <property value="Comments"/>
    </Misc>
    <EmptyTag/>
</PD>

I do not understand the DOM structure enough to try to find a cure for this. Also, setting tree.EmptyTag=' ' (one or more spaces) results in the same output.

How can this be corrected?

23 Oct 2009 xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski Sebastiaan

    <Misc>
        <property value="Comments"> </property>
    </Misc>
    <EmptyTag>
    </EmptyTag>
</PD>

Which is read in Matlab as:
tree =
         Misc: [1x1 struct]
     EmptyTag: []
    ATTRIBUTE: [1x1 struct]

tree.Misc.property =
      CONTENT: []
    ATTRIBUTE: [1x1 struct]

So far, so good. However, on writing, the XML file is malformed:
<?xml version="1.0" encoding="UTF-8"?>
<PD version="4.1">
    <Misc>
        <property value="Comments"/>
    </Misc>
    <EmptyTag/>
</PD>

I do not understand the DOM structure enough to try to find a cure for this. Also, setting tree.EmptyTag=' ' (one or more spaces) results in the same output.

How can this be corrected?

EDIT
Ok, it is amazing how fast bright ideas come after posting a problem.

I noticed that setting:
set(objOutputFormat, 'PreserveSpace', 'on')
in xmlwrite_xerces.m ~ line 48 deals with the problem and outputs a genuine XML file.

Unfortunately, the layout is unreadable (for larger xml files) to the eye:
<PD version="4.1"><Misc><property value="Comments"></property></Misc><EmptyTag></EmptyTag></PD>

Top Tags Applied by Jaroslaw
chemistry, gammaray, mass attenuation coefficients, photon attenuation, physics
Files Tagged by Jaroslaw View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
26 Jun 2009 Published M-Files xml_io_tools Read XML files into MATLAB struct and writes MATLAB data types to XML Author: Jaroslaw Tuszynski data, data import, data export, xmlwrite, tools, xmlread 194 35
  • 4.78261
4.8 | 24 ratings
12 Mar 2007 Published M-Files PhotonAttenuation 2 Provides the attenuation and energy absorption of x-ray and gamma-ray photons in various materials. Author: Jaroslaw Tuszynski physics, photon attenuation, gammaray, mass attenuation coef..., xray, chemistry 25 1
  • 5.0
5.0 | 2 ratings
16 Jun 2006 PhotonAttenuation Function providing the attenuation and energy absorption of x-ray and gamma-ray photons in various Author: Jaroslaw Tuszynski physics, photon attenuation, gammaray, mass attenuation coef..., xray, chemistry 14 1
  • 4.0
4.0 | 3 ratings
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com