2.2.7 copydata

Brief Information

Copy numeric data from source columns/rows to destination columns/rows

Command Line Usage

1. copydata irng:=col(1) orng:=col(2) clear:=1; //Copy data from column 1 to col 2 first clearing col 2.

2. copydata irng:=[Book1]Sheet1!col(2)[4] orng:=[Book2]Sheet1!col(2)[4]; // Copy row 4 of col 2 of sheet1 in Book1 to same place in Book2.

3. copydata irng:=([Book1]Sheet1!2[5]:3[11],[Book1]Sheet1!3[3]:4[8]) orng:=[Book2]Sheet1!3[4:4] clear:=1; // Copies non-congruous data from one book to another, rearranging in process.

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input irng

Input

Range

<active>
Specify the input data range (source).
Output orng

Output

Range

<new>
Specify the output range (destination).

See the syntax here.

Clear data in destination range before copy. clear

Input

int

0
Specify whether or not to clear data in destination range before copying. If 1 (or checked in dialog), all data will be cleared and mark as missing value "--".

Description

This function copies numeric data between a source range and a destination range. If there is non-numeric data in the source range, Origin will not copy the non-numeric data. Rather, it will set the destination cells to missing values. Note: This X-function only copies data and not any label row contents or formatting.

Examples

// In this example we use copydata to copy an column of data to a new worksheet then break the column into ten separate columns.

newbook; // Create a new workbook.
col(1) = data(1,100); // Fill column with row numbers from 1 to 100.
range r1 = 1; // Range is column 1 of this sheet.
newsheet; // Add a new sheet and activate.
range r2 = 1; // Range is column 1 of new sheet.
copydata irng:=r1 orng:=r2 clear:=1; // Copy column 1 from first sheet to second sheet clearing that columns fist.
wks.ncols = 10; // Add some columns

// Now rearrange the first column in second sheet into ten different columns of ten rows each.
loop(ii, 2, 10)
{
	// Below notice how the columns are referenced by column number 1 signifies the 1st column
	// and $(ii) represents cols 2 to 8 as loop progresses.
	// The orng destination only needs the first row specified and the rest of rows will be automatically filled.
	copydata irng:=1[$(10*(ii-1)+1):$(10*ii)] orng:=$(ii)[1];
	ii++;
}

mark -d col(1) -b 11 -e 100; // Delete the extraneous rows left over in column 1.

Result of Script Execution

Copydata ex 1.png