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
 Problem reading text after upgrading

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
kippvs Posted - 06/04/2011 : 12:57:50 AM
Using OriginLabPro 8.5.1 SR1 for Windows 7.

Hi there. I've been using the same script in 8.1SR3 with no problems for quite a long time, but just upgraded and am now having problems with it. Here is the basic scripting problem.

I've got two columns of text. I search column 1 row-by-row for a certain value and then read column 2 at the same row, like this:

loop(n,1,wks.nRows)
{
if(wcol(1)[n]$ == "test")
{
readtest$ = wcol(2)[n]$;
}
}
readtest$=;

Really simple, but for some reason this doesn't store anything into 'readtest' - it just comes out empty. On the other hand, if I get rid of the loop and manually point to the correct row, it reads the column 2 value and stores it just fine.

Any idea why this would stop working after upgrading?

Thanks.
~Kipp
3   L A T E S T    R E P L I E S    (Newest First)
kippvs Posted - 06/07/2011 : 5:32:56 PM
Thanks for the heads-up on column headers. I had no idea that N was reserved for short name. Even declaring as "int n=1" doesn't override this.

I'll just change the variable declarations throughout my scripts as this workaround seems to work fine (although, I am a bit addicted to 'n' in my scripting and will certainly miss using it).

Thanks again, guys.
~Kipp
greg Posted - 06/07/2011 : 5:06:14 PM
There are other variables to watch out for when using row index syntax since they are used to access MetaData in the header rows:

%A = col(B)[L]$;%A=; // Long Name
%A = col(B)[U]$;%A=; // Units
%A = col(B)[C]$;%A=; // Comments
%A = col(B)[R]$;%A=; // Sampling Interval
%A = col(B)[P1]$;%A=; // Parameter1
%A = col(B)[Temperature]$;%A=; // User-defined parameter row

If you really mean the values of a variable by the same name, then use:

%A = col(B)[$(L)]$;%A=;
%A = col(B)[$(U)]$;%A=;
%A = col(B)[$(C)]$;%A=;
%A = col(B)[$(R)]$;%A=;
%A = col(B)[$(P1)]$;%A=;
%A = col(B)[$(Temperature)]$;%A=;

N (as a string) was supposed to mean Short Name, but as Easwar points out, there is some problem.
easwar Posted - 06/07/2011 : 3:49:22 PM
Hi Kipp,

We will look into why this broke, sorry for the inconvenience. In the mean time, it is better to explicitly declare a variable and use, such as:


int irow;
loop(irow, 1, wks.nrows)
{

}

// or use for loop
for(int irow=1; irow<=wks.nrows; irow++)
{

}



Easwar
OriginLab

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