home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 7
/
FreshFishVol7.bin
/
new
/
misc
/
sci
/
multiplot
/
rexx
/
2pointsslope.mpt
next >
Wrap
Text File
|
1994-04-17
|
1KB
|
91 lines
/* This script calculates the formula of a straight
line which passes through two selected points */
port= 'MULTIPLOT.01'
RESULT=''
RC=0
/* Check Multiplot is running */
options results
if(~show('p',port)) then do
say "Please start Multiplot first"
exit 1
end
address value port
/* Check a PLOT WINDOW is active */
'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
/* Check two (and no more) Data Sets are selected */
'PEEK 3 NOVALS'
if(rc =0) then do
'SAY Please select only 2 points.'
exit 1
end
'PEEK 2 NOVALS'
if(rc~=0) then do
'SAY Please select 2 points first.'
exit 1
end
'PEEK 1 NOVALS'
if(rc~=0) then do
'SAY Please select 2 points first.'
exit 1
end
/* First point */
'PEEK 1'
point1=POINT
/* Second point */
'PEEK 2'
point2=POINT
/* Make new data set for values */
'SETADD'
'QUERY'
if(rc ~=0) then do
say "QUERY command failed!"
exit 1
end
setnum=word(RESULT,4)
if(compare('CUSTPLOT',RESULT)<8) then do
'SAY SetAdd command failed.'
exit 1
end
'POINT 0 STAR'
'COLOUR 1'
'PLOT POINT'
'CONTINUE'
/* Add two points to new set */
'SET' word(point1,1) 'XVAL'
'SET' word(point1,2) 'YVAL'
'CONTINUE'
'SET' word(point2,1) 'XVAL'
'SET' word(point2,2) 'YVAL'
'CONTINUE'
'STOP'
'SELECT SET' setnum
'SELECT REPLACE'
'FUNCTION SLINE'
'SELECT SET' setnum
'SELECT REPLACE'
'DELETE'