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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 How to translate a tree into a string?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tschunck

Germany
13 Posts

Posted - 01/23/2024 :  10:44:11 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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?

YimingChen

1657 Posts

Posted - 01/23/2024 :  11:41:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000