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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Different formulas for different cells of column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JonasKlim

Lithuania
36 Posts

Posted - 10/08/2017 :  08:06:20 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
A as long time user of Excel I am curious if different formulas can be used for calculation of values of different cells of the same column.
For example, C[1]= max(A), C[2]= min(A). If yes, how to write a script?

Edited by - JonasKlim on 10/08/2017 08:07:11 AM

nick_n

Finland
125 Posts

Posted - 10/08/2017 :  3:16:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

For your example it will be: col(C)[1]=max(col(A)); and col(C)[2]=min(col(A));. See more at http://www.originlab.com/doc/LabTalk/ref/Col-func.

Moreover, pay attention for ranges (http://www.originlab.com/doc/LabTalk/guide/Range-Notation). They provide access to any book, sheet, or plot. BR,

Nikolay
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 10/08/2017 :  8:29:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
In the upcoming Origin 2018, that would be exactly what you do,

put "=max(A)" into C[1] and "=min(A)" into C[2].

CP
Go to Top of Page

JonasKlim

Lithuania
36 Posts

Posted - 10/09/2017 :  05:21:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, Nikolay,
Thank you. Now I understood the trick: while in dialog window, I have to put the cursor on the cell I want to enter formula and then edit the formula in dialog window.
Could you please help with one more issue: if I write an expression to calculate row number, like "P[1]=list(min((F[60:160]));F)", and then use P[1] as an input to calculate simple formulas, like N[1]=K[P[1]+5], it works fine.
But, if I try to do the same with functions, like changing fixed row numbers in formula "list(min(G[0:55]);G[0:55])" to calculated row numbers in "list(min(G[0:P[1]]);G[0:P[1]])", I do not get result.
Regards, Jonas




quote:
Originally posted by nick_n

Hi,

For your example it will be: col(C)[1]=max(col(A)); and col(C)[2]=min(col(A));. See more at http://www.originlab.com/doc/LabTalk/ref/Col-func.

Moreover, pay attention for ranges (http://www.originlab.com/doc/LabTalk/guide/Range-Notation). They provide access to any book, sheet, or plot. BR,

Nikolay

Go to Top of Page

nick_n

Finland
125 Posts

Posted - 10/09/2017 :  3:55:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
First of all, sorry for confusing. I thought that you tell about LabTalk script, whereas it was "Set value" dialog. Both of them are powerful features and have some basic similarities. Nevertheless, there are some differences in using.
However, "Set value" is much more easy to use, LabTalk gives more flexibility (it's my personal opinion).

Well, in this case I would prefere to use LabTalk, just simple run from Script window (Alt+Shift+3 to open).
Put there your script like: col(P)[1]=list(min(col(G)[1:55]), col(G)[1:55]); select your script e.g. Ctrl+A, press Enter.
Regards,

Nikolay
Go to Top of Page

JonasKlim

Lithuania
36 Posts

Posted - 10/12/2017 :  01:25:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Nikolay,
Thank you. I started using LabTalk.
Best regards,
Jonas
quote:
Originally posted by nick_n

Hi,
First of all, sorry for confusing. I thought that you tell about LabTalk script, whereas it was "Set value" dialog. Both of them are powerful features and have some basic similarities. Nevertheless, there are some differences in using.
However, "Set value" is much more easy to use, LabTalk gives more flexibility (it's my personal opinion).

Well, in this case I would prefere to use LabTalk, just simple run from Script window (Alt+Shift+3 to open).
Put there your script like: col(P)[1]=list(min(col(G)[1:55]), col(G)[1:55]); select your script e.g. Ctrl+A, press Enter.
Regards,

Nikolay

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000