The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 How to translate a tree into a string?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
tschunck Posted - 01/23/2024 : 10:44:11 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2024 (64-bit) 10.1.0.170

Operating System: Win10

I imported data to origin and created a page.tree.Importfilename. tree node that holds line by line the whole header.
Each header-line contains a structure like :
filename: xyz.txt

In Labtalk I can call for page.tree.%h.filename:$= and get the information I am interested in.

From time to time the length of my header varys.

I want to get all information in the tree node into one stringvariable or into a stringarray in order to postprocess information stored in the tree without nooing the exact names of all variables.

The tree might contain information on the subjects in ethe experiments.
Subject1.name:$=
Subject2.name:$=


e.g. I want to know how many subjevt*.name-lines there are in the header.


How to translate a tree into a string?
1   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 01/23/2024 : 11:41:08 AM
You can use ToString() to convert treenodes to XML string. Please try the example code below:

page.tree.sample1.name$ = "Jack";
page.tree.sample1.gender$ = "Male";
page.tree.sample1.age = 23;
string str;
page.tree.ToString(str$);
str$=;


James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000