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
 LookUp / Cell / Set Value Help please

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
khblue Posted - 12/07/2018 : 11:55:30 AM
Origin Ver. 2018b and Service Release b9.5.5.409 educational
Operating System: Win 7


I'm new to LabTalk and only recently back using Origin. I'm not sure what I'm suggesting is an efficient solution, but hopefully my inept attempts will help understand the problem. Please suggest a best method or correct my syntax/coding. Many thanks.

PROBLEM:
I want to use the VALUE from the current book and sheet, Col A, row [i] as the ROW Number for selecting the value from a different book and sheet, in column 1, and putting it in Col B of my current sheet.

MY FIRST ATTEMPTED SOLUTION:
Col(B)=cell://[Data1]Sheet1!A[cell://A[i]]

MY SECOND ATTEMPTED SOLUTION:
Before formula script:
double HERE = [Data2]Sheet1!Cell(i,1)

Col(B) = [Data1]Sheet1!Cell(HERE,1)
8   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 12/11/2018 : 10:56:08 AM
Please check this method:


Thanks,
James
khblue Posted - 12/11/2018 : 10:20:40 AM
Thanks James. I ended up here, which works but is probably inefficient:

-----------------------------------------
Dataset TROUGHS = {1:1:200};
double value = 0;
int line = 1;

For (n=1;n<200;n++)
{
// get the x-value for the next trough
line = [Data2]Sheet1!Cell(n,1);
// use the x-value to look up the y-value
// of the peak in the original data set

value = [Data1]Sheet1!Cell(line,2);
// put that value in the temporary data set
TROUGHS[n] = value;
}

// Assign column values from the temporary data set
Col(B)=TROUGHS
--------------------------------
YimingChen Posted - 12/11/2018 : 09:20:47 AM
Hi,

Sorry for the confusion. In Set Column Values dialog box, Before Formula Scripts box accepts LabTalk script, while Col(B)= box is accepting expression in which case you can put in an expression which returns a number. So your second method should work. Please see attached pic:


Hope this answers your question, thank you.

James
khblue Posted - 12/11/2018 : 05:19:21 AM
Hmmm, I'm not getting further with that.

In the dialogue box I have a 'Before Formula Script' and 'Col (B) ='
box. Perhaps I need to create an array and populate it using the 'Before Formula Script' box then set Col (B) = MyArray.

Saying that I have no idea about how to do that, it's been about 10 years since I did any coding and that was C/C++ !!

Any more specific help would be really valued,
thanks.
khblue Posted - 12/11/2018 : 04:55:40 AM
thanks I'll give it a go
YimingChen Posted - 12/10/2018 : 2:43:40 PM
Here col(B) is a dataset, only array can be assigned to dataset, setting a value to dataset is syntactically not valid.

James
Blauser Posted - 12/10/2018 : 07:47:12 AM
Are you not supposed to assign a value to a range? Why's that?
YimingChen Posted - 12/07/2018 : 1:48:44 PM
Hi,

I think the reason is that you try to assign a value to a range. You can try:
col(B)[1] =  [Data1]Sheet1!Cell(HERE,1);


Thanks,
James

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