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
 Forum for Origin C
 Reading and writing header info variables

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
PhilTHy Posted - 08/31/2006 : 08:42:04 AM
Origin Version (Select Help-->About Origin): OriginPro 7.5
Operating System: Win XP

I have an ASCII text data file type that has a lot of header rows (30). The delimiters are not consistent: most are colons but some are spaces. A few header rows have more than one pair of descriptor - variable values.

The import wizard manages commendably well, but column name and labels for example need some tidying up afterwards, and some of the header variable values I need to use subsequently in numerical analysis.

The datafile is produced by commercial instrument software; modifying the datafile at source isn't a viable option. I could write a pre-parser module to convert the header into a form that the Origin Import Wizard could readily handle, but this seems relatively hard work compared to just tidying up the few variables that matter after import into Origin. Not least because all my previous programming experience is in Fortran & VB. Origin is my first foray into the wonderful world of C :-)

So what I'd like to do, is read the variables using the "L1V1" reference from the header info variables, into C, and then write values back into a worksheet.

The job would be even neater if I could write back to the header info variable, to change the "L1V1" descriptors to more meaningful descriptors.
3   L A T E S T    R E P L I E S    (Newest First)
PhilTHy Posted - 08/31/2006 : 12:00:49 PM
Thanks Mike this works beautifully

Phil
Mike Buess Posted - 08/31/2006 : 10:40:01 AM
You can use page_get_info_var_value to get the string value of the "LnV1" descriptor, parse that string using string class functions and save your new values using page_set_info_var_value. The code will look something like this...

WorksheetPage wpg("Data1");
string str;
page_get_info_var_value(wpg, "L1V1", str, "User.Variables");
// parse str into (string) varName and (string or double) varValue
page_set_info_var_value(wpg, varName, varValue, "User.Variables");

Mike Buess
Origin WebRing Member
zachary_origin Posted - 08/31/2006 : 10:27:02 AM
It is hard to know exactly about the structure of the data file just from the description. So if it is possible, can you post the header lines here or send to data file to us thru tech@originlab.com and note what messages you want to get.

Zachary
OriginLab GZ Office

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