Importing Coordinates from a SVG file

9 Ansichten (letzte 30 Tage)
wan ji
wan ji am 11 Mai 2013
Bearbeitet: Stephen23 am 25 Feb. 2016
I'm unable to import a number of coordinates given an image SVG file (I'm using MATLAB)
I've place a quater of the code at the bottom, I would need to extract values x1, y1, x2, y2 into an array
SVG File below
version="1.0" encoding="UTF-8" standalone="no"? Created with vcg library -- <svg width="12.000000cm" height="12.000000cm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"
id="svg2"> <defs id="defs4"/> <metadata id="metadata7"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> /metadata
<rect width= " 10.000000cm " height= " 10.000000cm " x="1.000000cm " y="1.000000cm " style= " stroke-width:1pt; fill-opacity:0.0; stroke:rgb(0,0,0)" />
<g stroke="black" stroke-linecap="round" stroke-width = "0.010000pt" >
<svg id = "SliceNum0" viewBox="-1000 -1000 2000 2000" width="10.000000cm" height="10.000000cm" x="1.000000cm" y="1.000000cm" >
<line x1="-63.229714" y1="492.005054" x2="-70.692627" y2="470.414368" />
<line x1="-70.692628" y1="470.414374" x2="-83.125908" y2="442.229187" />
<line x1="-83.125901" y1="442.229169" x2="-94.513908" y2="416.413513" />
<line x1="-51.447549" y1="526.091518" x2="-63.229717" y2="492.005035" />
<line x1="-36.903449" y1="583.083783" x2="-46.830318" y2="544.184509" />
<line x1="-46.830319" y1="544.184534" x2="-51.447548" y2="526.091492" />
<line x1="-26.013913" y1="654.669715" x2="-27.154661" y2="641.021606" />
<line x1="-27.154663" y1="641.021617" x2="-34.309368" y2="598.500549" />
<line x1="-34.309370" y1="598.500561" x2="-36.903450" y2="583.083801" />
<line x1="-22.264416" y1="699.529173" x2="-26.013912" y2="654.669678" />

Antworten (1)

Yves
Yves am 16 Sep. 2014
Bearbeitet: Stephen23 am 25 Feb. 2016
Hello, I know it has been a while since you posted this, but here is a small code to extract the information from your svg file. It will give you a structure with the names of the fields automatically taken from the file.

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by