3.3.2.12 Delete


Delete the specified object.

This command works primarily on datasets and variables.

  • If you wish to delete an entire page (i.e., workbook or graph window), see the Window -c command.
  • If you wish to delete the active layer (i.e., worksheet in book or layer in graph), see the Layer -d command.
  • If you wish to delete the text labels or graphic objects, see the Label -r command.

Syntax

delete [option] <name>

OR

del [option] <name>

Options

Option What Gets Deleted/Cleared
(none) Dataset, or portion of a dataset
@ Delete value of registry-stored system variable
a Temporary datasets (all)
al Local variable
as Hidden dataset
f File specified by filepath
m Macro
oc Origin C temp folder (clear)
ocb OCB file
oct Origin C Workspace (clear)
occlean Origin C source files (reset)
op Pending recalculate operations
path User Folder path and Application Data Folder value in registry (clear)
r DataRange
ra Local variable
rar Range variable
ras String variable
rav Numeric variable
rac Constant
rat Tree variable
raa String array
rag Graphic object
raf Local Function (8.1 Beta2)
rn named ranges (2025)
s Dataset or function
sr The same (duplicated) datasets (9.0 SR0)
sd Specified dataset, reset all dependent datasets
v Global/project numeric variable
vs Global/project string variable.
web Web Connector URL-to-File cache.

Examples

(no option); Delete the dataset or portion thereof

Syntax: del <name>

Script Examples:

del Col(B);         // Deletes Column B of the active worksheet

range bb = 2;
del bb;             // Same as 'del Col(2)'

range bc = 2[1:2];
del bc;             // Deletes rows 1-2 of Column 2; shifts cells up.

@; Delete value of registry-stored persistent system variable

Syntax: del @

Note that this switch differs from other switches in that you DO NOT precede the switch with a dash(-) character. When used by itself, as in ...

del @;

... ALL persistent variable values stored at HKEY_CURRENT_USER\SOFTWARE\OriginLab\SysVar will be deleted. To selectively delete persistent variable values from the registry, follow the "@" symbol with (a) a particular persistent variable or (b) use letters in combination with the asterisk (*) wildcard character, as in the following examples:

del @AWC // deletes the value of @AWC stored in the registry
del @A*  // deletes the values of all registry-stored variables that begin with letter "A"

See the list @ command.


-a; Delete all the temporary datasets

Syntax: del -a

Delete all the temporary datasets, including all the axes datasets. A temporary dataset has a name which starts with an underscore ("_") character, e.g., _temp.


-al; Delete a local variable (of any type)

Syntax: del -al varName

Delete the local variable with name varName. If varName is of the string type, do not include the trailing $-sign.

double aa=col(2)[1];
string ss$="First cell of 2nd col is $(aa)";
type ss$+", and 3rd is $(col(2)[3])";
del -al aa;
del -al ss;

After the above code, you can do a list a and verify that both variables are gone.


-as; Delete the hidden datasets

Syntax: del -as

Delete all datasets that are not in any worksheet and not used in any graphs.

// Delete all the orphaned loose datasets.  Use ''list so'' to check it.
create cc -wdn 10 a,b,c;
del -as;


-di; Delete all imported data

Syntax: del -di

Delete all imported data from the project, including data imported and saved during previous sessions.


-f; Delete a file specified by filepath

Syntax: del -f filepath

Delete a file specified by filepath

The following will delete macros.cnf from the User File Folder if it existed

del -f "%Ymacros.cnf";

silent delete

del -fs path

Pass in a full path with file name with wild cards to delete multiple files. Pass in a full path with ending '\' will delete directory and all files and directories in it.


-fc; Reset custom format list to factory default

Syntax: del -fc

The user's Origin.ini file, saved to the User Files Folder, contains a [Column Custom Format List] section that, over time, accumulates all custom formats entered into dialog box custom format lists (e.g. Column Properties). As the list accumulates, these dialog box custom format lists become difficult to use. Use this command to clear the list.


-fi; Delete File Import information

Syntax: del -fi

Delete the file import information saved in the worksheet. It is useful if the analysis template imports data with import X-Function in the first place and you want to use Data Connector to import data later. This may be the case if the template was made in some old version like Origin2019 and reused in newer version like Origin2020b. You will need to run this command first to clear old import info saved in the worksheet.


-i; Clear all the search indexing

Syntax: del -i

If you run into trouble not finding the correct things by Origin's Start button, you can use this option to reset the indexing. Next time you click Start button, the search bar should be disabled and show the text "Indexing... please wait" until the indexing is done.

-jax; Reset LaTeX JS MathJax

Syntax: del -jax

Reset LaTeX JS MathJax.

-m; Delete the specified macro

Syntax: del -m macroName

Delete the macro macroName.

def double { type "$(%1 * 2)"; }; // Define a macro.
del -m double;

The following script deletes the macro named AutoExec:

del -m AutoExec;


-oc; Clean OC temp folder

Syntax: del -oc

Delete all OCB files from the OC Temp folder. This is sometimes needed when source OC file has changed but with an older date and you want to force recomplile those OC files.


-ocb; Delete OCB file

Syntax: del -ocb

del -ocb filepathname1.c
del -ocb filepathname1.ocw
del -ocb filepathname1.c filepathname2.c // delete multiple files
del -ocb %YOCTEMP\filename.c // use %Y to get to the Users Files Folder

For more information on it's use see LabTalk.CHM: Programming in LabTalk: Updating an Existing Origin C File


-oct; New OC Workspace

Syntax: del -oct

Reset OC user workspace to a new empty one.


-occlean; Reset OC to use all new source files

Syntax: del -occlean

This command deletes all OCB, OP, OPH files and also to remove entire OCTemp folder. After this command, you must have all the original OC source code to properly compile Origin system OC files.

This command is stronger the -oc, so if -oc does not work, you can try this. This was added for Origin C developers during the days of the Developers Kit.

-op; Delete pending recalculate operations

Syntax: del -op [UID]

Minimum Origin Version Required: 8.5.1

Without the UID, it will clean up all the pending recalculate operations which are without input or output. Or it will delete the pending recalculate operation with UID, including the output of the operation. To see the pending operations, including UID, please use the list opp command.

delete -op;     /// clean up dangling operations with empty input or empty output
delete -op 779;  /// delete operation with UID 779 and its outputs

-path; Clear the User Folder path

Syntax: del -path [UFF]

This option can be used to reset the path of User Folder.

// Reset the User File Folder, next time you start Origin: 
del -path;
// Reset the User File Folder the next time you start Origin:
del -path UFF;

-r; Remove (Delete) DataRange

Syntax: del -r

// Delete all DataRange, including Autofill and operations ranges etc.
del -r;
// Delete all orphaned operations ranges:
del -r 16;
// Delete all AutoFill ranges:
del -r 32;

-ra; Remove (Delete) local variables

Syntax: del -ra VarName

(Available in Version 8.0 SR3 and newer)

// Delete local variables 'aa':
del -ra aa;
// Delete local variables with names starting with the letter 'a'.
// The * is a wildcard character:
del -ra a*;


// Delete all local variables in the current scope: 
del -ra *;


Note: del -ra * will not delete session-level constants, so for instance, pi will not be removed by del -ra *. But, if you enter del -rac * within session scope, pi will be deleted. At local level, locally-defined constants will be deleted by del -ra *.

-rn; Remove (Delete) named ranges

(2025) Syntax: del -rn [name] [scope]

name support wildcard, scope can be 0(Sheet), 1(Book), 2(Project)

//delete all named ranges in project
del -rn ;

//delete all named ranges in project and dump number of Named Range deleted
del -rn *;

//delete all named ranges in book scope starting with alpha
del -rn alpha* 1 ;


-s; Delete the given dataset or function

Syntax: del -s name

Delete the given dataset or function. All dependent datasets are also deleted.

del -s col(C);


-sd; Delete only the specified dataset and reset all other dependent datasets

Syntax: del -sd name

Delete only the specified dataset and reset all other dependent datasets.

create temp -wd 50 a b c;
list s; //shows temp_a, temp_b, temp_c;
del temp_c; 
list s; // only temp_c deleted
del temp_a; 
list s;
// temp_b deleted as well since it has X dependency on temp_a

Now compare with the following:

create temp -wd 50 a b c;
list s;
del -sd temp_a;
list s;
// still shows temp_b and temp_c


-si; Delete all datasets with invalid name

Syntax: del -si

Delete all dataset with invalid name

Origin Version: 2017

-spk; Delete all project sparklines

Syntax: del -spk

Also, see system variable @SPK

Origin Version: 2022b

-sw; Delete a set of dataset whose name includes specified characters

Syntax: del -sw name

Delete a set of dataset whose name includes characters specified in name. Wildcard is supported

Origin Version: 2017

create temp -wd 50 aa ab c;
list s; //shows TEMP_AA, TEMP_AB, TEMP_C;
del -sw temp_a*; //delete datasets whose name includes "temp_a"
list s;
// TEMP_AA, TEMP_AB are deleted

-v; Delete the specified numeric variable

Syntax: del -v varName

This command is used to delete the specified user-defined variables, but it won't touch the system variables.

// Define a user-defined variable numeric variable "ProNum"
ProNum = 100;        
list v;                 // Check variable list to make sure it shows up
del -v ProNum;       // Delete the variable named 'globalNum'
list v;                 // Re-check the list to make sure it is gone
del -v ex*;             // Delete all user-defined variables that begin with "ex"


Please note, for the earlier versions than Origin 2020, delete -v *; will delete all variables including the system variables. You might need run list v; to check the variables and then execute the deletion more precisely.

-vs; Delete the specified global/project string variable

Syntax: del -vs stringVarName

// Omit the trailing $-sign from the string variable name:
// Define global/project variable globalStr$ = "Hello"
globalStr$ = "Hello";    
list vs;                 // Check variable list to make sure it shows up
del -vs globalStr;       // Delete the variable 
list vs;                 // Re-check the list to make sure it is gone

Note: This command supports wildcard since Origin 9.0.

-web; Clear the URL-to-File cache used by Web Connectors (Data: Connect to Web)

Syntax: del -web URL

delete -web "http://www.sidc.be/silso/INFO/snmtotcsv.php";

See LabTalk system variable @CFDT.