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
 point data

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
razva Posted - 08/30/2006 : 6:40:02 PM
Origin Version (Select Help-->About Origin): originpro 7.5 SR5
Operating System:Win XP SP2

Hi.
I want to create a script in labtalk to extract the value in a certain column at a certain row position. or better value in a certain row corresponding to a given X value.
The value extracted to be then exported to a notepad file (or result window) together with the label of the datasheet the value had been extracted from.
This script should be applied for all datasheets in the current folder, not for the entire project.
It should not be so difficult such a script but I cannot manage to make it work as it should beand I am a little bit in a hurry.

thank you
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 09/13/2006 : 05:24:08 AM
Use quotation marks... type "$(%(%h, 2, $(ii)))";
quote:
Another problem which might be related with the one above mentioned is that the label of the workseets in not completely shown when displaying the result (only some couple of characters are missing)


Most LabTalk letter variables can hold no more than 260 characters. (Exception is %Z which holds approx. 8k characters.) Perhaps the labels are truncated. Try %Z=page.label$ instead.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/13/2006 05:50:35 AM
razva Posted - 09/13/2006 : 04:06:20 AM
Thank you so much for your help.
I am sorry for this late reply.
I have modified the script to match my needs and it works perfectly, except for the cases when the value I am gathering from column no. 2 is negative.
Another problem which might be related with the one above mentioned is that the label of the workseets in not completely shown when displaying the result (only some couple of characters are missing)

the modified script i am using now is the following:

window -n n ExtractResult;

//Set the notes window as the current output window.
type.notes$=ExtractResult;
old = type.redirection;
type.redirection = 2;
type "Extractiong result:";

doc -ef w
{ //loop over all the worksheets in current folder
nrow=wks.maxRows; //The maximum row index number that contains a value

for (ii=1; ii<nrow; ii++) //loop over the rows
{
%a=%(%h, 1, $(ii));
if (%a==1520)
{
type %h; //Type the name of the worksheet
type $(%(%h, 2, $(ii))); //Type the corresponding value in column 2
%j=page.label$; //get the label of the current worksheet
type %j; // type the label into the result window
type "";
};
};
};

type.redirection = old; //Restore the output window
Deanna Posted - 08/30/2006 : 10:06:19 PM
Hi.

To output to a notes window or the result log, you can refer to the type object in the Labtalk Language Reference.

To loop over the worksheets in the current folder, you can use
doc -ef w {...}.

The following script creates a notes window, searches through all the worksheets in the current folder for all the x values that is equal to 3, and then outputs the value in the second column in the same row. The X values are assumed to be in the first column of each worksheet. I think you can modify this script to suit your need.


//Create a notes window with the title ExtractResult
window -n n ExtractResult;

//Set the notes window as the current output window.
type.notes$=ExtractResult;
old = type.redirection;
type.redirection = 2;
type "Extractiong result:";

doc -ef w
{ //loop over all the worksheets in current folder
nrow=wks.maxRows; //The maximum row index number that contains a value

for (ii=1; ii<nrow; ii++) //loop over the rows
{
%a=%(%h, 1, $(ii));
if (%a==3)
{
type %h; //Type the name of the worksheet
type $(%(%h, 2, $(ii))); //Type the corresponding value in column 2
};
};
};

type.redirection = old; //Restore the output window




Deanna
OriginLab GZ Office

Edited by - Deanna on 08/30/2006 10:09:25 PM

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