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
 Row multiplication

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
zango24 Posted - 09/20/2017 : 1:09:05 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8
Operating System: 7

Dear Friends,
I need your help in the following calculation. I have a worksheet with X and Y column values. These columns contain several rows. E.g.
S. X Y
1 20 12
2 02 07
3 31 48
4 11 18
5 19 07
6 53 25
. . .


So, Now I would like to multiply row 1 of X to row 2 of X, then row 2 of X to row 3 of X, then row 3 of X to row 4 of X... and so on in a continuous fashion. Similar multiplication for Y rows too as row Y1*Y2 then Y2*Y3 then Y3*Y4 and so on.....

Actually, this type of calculation is required as a part of vector multiplication serise.
Any small worksheet script or method to execute this serise of multiplication would be a great help.
Thanks in advance,
Zan
4   L A T E S T    R E P L I E S    (Newest First)
zango24 Posted - 09/20/2017 : 11:02:19 PM
Dear Friend Snowli,
Thank you for your help. I have also checked this in my version 8 and its working like a charm too.
However, I have to do some modification may be due to the difference in the origin versions between yours and mine.

Instead of just taking B*B[i+1] in the "set column value", I have to use: col(B)[i]*col(B)[i+1] as suggested by you.

Thank you for your suggestions and help.
Cheers,
Zan


quote:
[i]Originally posted by snowli


You can use Set Column Value dialog for this but Origin 8 needs to use col(A) instead column shortname directly.

E.g. Here is how to do it in Origin 2017.


Thanks, Snow

zango24 Posted - 09/20/2017 : 10:56:27 PM
Dear Friend Nick_n,
Thank you for your help. I have checked its working like a charm. In fact, I have also checked by changing the column 1 or 2 to column 2 and 3 and its worked fine. I changed it because the first column of my data sheet contains serial number.
Now the new script would be:

int ii;
loop(ii, 1, wks.maxrows)
{
if (col(2)[ii+1]==NA || col(3)[ii+1]==NA) break; //check if data
col("MultipX")[ii+1]=col(2)[ii]*col(2)[ii+1]; //output X
col("MultipY")[ii+1]=col(3)[ii]*col(3)[ii+1]; //output Y
}

Cheers,
Zan



quote:
Originally posted by nick_n

Hi,

Try to run that script in Script Window (to open Alt+Shift+3):
X data should be in column 1 and Y in column 2.

int ii;

loop(ii, 1, wks.maxrows)
{
if (col(1)[ii+1]==NA || col(2)[ii+1]==NA) break; //check if data
col("MultipX")[ii+1]=col(1)[ii]*col(1)[ii+1]; //output X
col("MultipY")[ii+1]=col(2)[ii]*col(2)[ii+1]; //output Y
}

Best regards,

Nikolay

snowli Posted - 09/20/2017 : 4:43:19 PM
You can use Set Column Value dialog for this but Origin 8 needs to use col(A) instead column shortname directly.

E.g. Here is how to do it in Origin 2017.


Thanks, Snow
nick_n Posted - 09/20/2017 : 4:15:32 PM
Hi,

Try to run that script in Script Window (to open Alt+Shift+3):
X data should be in column 1 and Y in column 2.

int ii;

loop(ii, 1, wks.maxrows)
{
if (col(1)[ii+1]==NA || col(2)[ii+1]==NA) break; //check if data
col("MultipX")[ii+1]=col(1)[ii]*col(1)[ii+1]; //output X
col("MultipY")[ii+1]=col(2)[ii]*col(2)[ii+1]; //output Y
}

Best regards,

Nikolay

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