Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
scan txt file and change related information
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi, experts
I have a txt file, in which there are some information I want to adjust with efficiency. The txt file is actually generated by social network software: yEd - Graph Editor
the txt file structure is as below (a part of the txt file):
<node id="n0">
<data key="d4"><![CDATA[2.0]]></data>
<data key="d7">
<y:Geometry height="36.0" width="36.0" x="350.0" y="1550.1944444444443"/>
<y:Fill color="#FFFFFF" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" modelName="internal" modelPosition="c" textColor="#000000" visible="true" width="22.97265625" x="6.513671875" y="8.93359375">2.0</y:NodeLabel>
<y:Shape type="ellipse"/>
</data>
</node>
<node id="n1">
<data key="d4"><![CDATA[4.0]]></data>
<data key="d7">
<y:Geometry height="36.0" width="36.0" x="2299.1944444444443" y="127.0"/>
<y:Fill color="#FFFFFF" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" modelName="internal" modelPosition="c" textColor="#000000" visible="true" width="22.97265625" x="6.513671875" y="8.93359375">4.0</y:NodeLabel>
<y:Shape type="ellipse"/>
</data>
</node>
It's with common sense social network plot is actually connecting nodes by graphic theory. Codes above describes the properties of two nodes, with each node defined within
<node id="n0">
...
</node>
It's the first node. then the second one is
<node id="n1">
...
</node>
using the first node as an example, the second line
key="d4"<![CDATA[2.0]]></data>
indicates the node ID, here is 2.0, the number after "CDATA". One node property is the fill color
#FFFFFF indicates the colour.
The other property is the node shape:
"ellipse" is the shape.
So #FFFFFF and ellipse can be changed to another color and something like 'rectangle' or 'round'.
Now here is my question: this txt file is actually quite long, containing lots of nodes information, and notice that these nodes ID are not put in sequence. I have a list of IDs of nodes of my particular interests, I want to change "color" and "shape" information for those nodes. So, how can I setup an algorithm to locate "color" and "shape" of a particular node based on its ID, and change the "color" and "shape" to a value.
Many thanks for any help!!
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!