home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 7
/
FreshFishVol7.bin
/
new
/
misc
/
sci
/
multiplot
/
rexx
/
setsorty.mpt
< prev
next >
Wrap
Text File
|
1994-04-17
|
2KB
|
107 lines
/* This script sorts the data points by their X values */
port= 'MULTIPLOT.01'
RESULT=''
RC=0
options results
if(~show('p',port)) then do
say "Please start Multiplot first."
exit 1
end
address value port
'QUERY'
if(rc ~=0) then do
say "QUERY command failed!"
exit 1
end
if(compare('PLOWIN',RESULT)<6) then do
'SAY Please select a PLOT WINDOW first'
exit 1
end
'PEEK 1 NOVALS'
if(rc ~=0) then do
'SAY Please select a Data Set first'
exit 1
end
/* Collect values from set */
'PEEK 1 YVALS'
tempy=YVALS
'PEEK 1 XVALS'
tempx=XVALS
'PEEK 1 EVALS'
tempe=EVALS
'PEEK 1 EDWN'
tempedwn=EDWN
'PEEK 1 XEVALS'
tempxe=XEVALS
'PEEK 1 XEDWN'
tempxedwn=XEDWN
n=words(tempx)
XVALS=word(tempx,1)
YVALS=word(tempy,1)
EVALS=word(tempe,1)
EDWN =word(tempedwn,1)
XEVALS=word(tempxe,1)
XEDWN =word(tempxedwn,1)
do i=2 to n
testval=word(tempy,i)
xval=word(tempx,i)
eval =word(tempe,i)
edwnval =word(tempedwn,i)
xeval=word(tempxe,i)
xedwnval =word(tempxedwn,i)
do j=1 to i-1
if(testval<word(YVALS,j)) then do
testval=insert(testval,' ')
xval=insert(xval,' ')
eval=insert(eval,' ')
edwnval=insert(edwnval,' ')
xeval=insert(xeval,' ')
xedwnval=insert(xedwnval,' ')
YVALS=insert( testval,YVALS,(wordindex(YVALS,j)-1))
XVALS=insert( xval,XVALS,(wordindex(XVALS,j)-1))
EVALS=insert( eval,EVALS,(wordindex(EVALS,j)-1))
EDWN=insert( edwnval,EDWN,(wordindex(EDWN,j)-1))
XEVALS=insert( xeval,XEVALS,(wordindex(XEVALS,j)-1))
XEDWN=insert( xedwnval,XEDWN,(wordindex(XEDWN,j)-1))
j=i
testval=''
end
end
if(length(testval)>0) then do
testval=insert(' ',testval)
yval=insert(' ',yval)
eval=insert(' ',eval)
edwnval=insert(' ',edwnval)
xeval=insert(' ',xeval)
xedwnval=insert(' ',xedwnval)
YVALS=insert( YVALS,testval)
XVALS=insert( XVALS,xval)
EVALS=insert( EVALS,eval)
EDWN=insert( EDWN,edwnval)
XEVALS=insert(XEVALS,xeval)
XEDWN=insert(XEDWN,xedwnval)
end
end
/* Replace values in set */
'POKE 1 XVALS'
'POKE 1 YVALS'
'POKE 1 EVALS'
'POKE 1 EDWN'
'POKE 1 XEVALS'
'POKE 1 XEDWN'
'FULLPLOT'