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 for Programming
 LabTalk Forum
 mirror data

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
itelly Posted - 01/15/2018 : 06:11:42 AM
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
2   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 01/15/2018 : 10:36:56 AM
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
Chris D Posted - 01/15/2018 : 09:38:13 AM
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

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