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
 Origin Forum
 How use a string as range index?

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
islan Posted - 10/03/2013 : 09:07:38 AM
Hi

I'am new to OriginLab and try to work on some data.

My question is; why do I get 2 different results by write the same code?

1. range rPGain = [Book2]1!Col(59);

2. int GS = -1+rHS[76]*6; (=59)
range rPGain = [Book2]1!Col(GS);

For the first example I get a number as output but for the second example I get only a - as output.


And how can I make the second example working?

Thanks islan :)

Edit - I try to rephrase my problem:

I have to "Books" one is a database and in the oter I work with new data. For calculations I need information from the database, but it is not always the same column I need.

So how can one implement a variable column number in the range command?
i.e.

int ColumnNumber = x;
range database = [Book2]1!Col(ColumnNumber);

Or is there an other way to do it?

Thanks

Ursina

i.e.
2   L A T E S T    R E P L I E S    (Newest First)
islan Posted - 10/08/2013 : 03:58:55 AM
Hi Greg

thanks it works!

Ursina
greg Posted - 10/07/2013 : 2:27:16 PM
The COL( ) function can take numbers OR column names as an argument.
When you said
range rPGain = [Book2]1!Col(GS);
Origin was looking for a column named "GS".

We also have the WCOL( ) function which ONLY expects a number. If text is passed to the function then we assume it is a numeric variable and interpret the value as the column number.

So,
int ColumnNumber = x;
range database = [Book2]1!WCol(ColumnNumber);
should work.

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