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 for Programming
 LabTalk Forum
 mirror data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

itelly

3 Posts

Posted - 01/15/2018 :  06:11:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have a worksheet with some data. Now I want to mirror my data on the x-axis or copy the data underneath the last row while inverting the content of the y-column:

Here is my original data:
X Y value
1 6 11
2 7 22
3 8 33
4 9 44

This should be the result:
X Y value
1 6 11
2 7 22
3 8 33
4 9 44
1 -6 11
2 -7 22
3 -8 33
4 -9 44

Does anybody know how to do that in labtalk ( Origin 2015)

Thank you
itelly

Chris D

428 Posts

Posted - 01/15/2018 :  09:38:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

To achieve the pattern you illustrate, you can run this script in the Script Window. Links to related variable types and commands are below.

Range rngX = col(1);
Range rngY = col(2);
Range rngValues = col(3);
Dataset dsY = rngY * -1;
copy -a rngX rngX;
copy -a rngValues rngValues;
copy -a dsY rngY;

Range: https://www.originlab.com/doc/LabTalk/Tutorials/Tutorial-Range-Notation
Dataset: https://www.originlab.com/doc/LabTalk/guide/Data-Types-and-vars#Temporary_Loose_Dataset
Copy: https://www.originlab.com/doc/LabTalk/ref/Copy-cmd


Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 01/15/2018 :  10:36:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Just another snippet:
si=page.active;   //input sheet
wcopy  ow:=<new>; //duplicate
so=page.active;   //output sheet
col(2)=-1*col(2); //(-1)*column 2
wAppend irng:=([%h]$(si)!, [%h]$(so)!) method:=row ow:=[%h]$(si); //Append back
layer -d $(so); //Delete output sheet
--Hideo Fujii
OriginLab
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