An example of a simple Modeling command to set channel one of a file to the value zero is:
model on "irvine.pix" %1 = 0 endmodel
As shown in this example, a channel is specified using the special symbol "%". Similarly, to set the first channel to the sum of the second and third channels, the command
%1 = %2 + %3
can be used within the body of the model command. It is also possible to use variables or even expressions that evaluate to channel numbers in a Modeling expression. In order to do this, curly braces are used around the expression that specifies the channel.
%{i} = %{i+1} + %{i+2}
All of the channels being referred to in the Modeling expression must exist on the file referred to in the MODEL command, however, it is possible to specify channels in different files. In this case, the file specifier of an open file needs to be given in addition to the channel number within the braces.
The following example copies channel 1 of the file "file.pix" to the file "irvine.pix":
local int fd
fd = DBOpen( "file.pix", "r" )
model on "irvine.pix"
%1 = %{ fd, 1}
endmodel
call DBClose( fd )
When multiple files are being used, the window on which the operation is performed is the window corresponding to the default file, that is, the file specified in the MODEL command. Since no window has been specified in the previous example, the entire database size of "irvine.pix" is used. If "irvine.pix" has a size of 512 pixels 512 lines, and "file.pix" has size 1024 pixels by 1024 lines, only the 512 by 512 subwindow in the top left corner of "file.pix" will be copied.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.