RESTORE TO command

Post Reply
the_wesley_watkins
Posts: 42
Joined: Wed Jul 29, 2015 3:53 pm
My devices: Ipad
Iphone

RESTORE TO command

Post by the_wesley_watkins »

Could someone give me an example of how to use the RESTORE TO LABEL command?

I am trying to read in data from another file, so I setup labels within the file that has my data. It looks sort of like:

temps:
DATA dsfasdf
DATA dasdfa
DATA dasfasd

meds:
DATA dfasdf
DATA dasfsad



Here is the code I use to read in the data:

Code: Select all

numtemps = 0
WHILE 1=1
	READ hold$
	numtemps += 1
	IF hold$ = "201508030555*temp*98.6" THEN BREAK   'Breaks at the last temp
END WHILE

DIM holder$(200)
DIM tempstr$(numtemps)
DIM temp(5, numtemps)
DIM tempyrstr$(numtemps)
DIM tempyr(5, numtemps)
DIM tempmstr$(numtemps)
DIM tempm(5, numtemps)
DIM tempdstr$(numtemps)
DIM tempd(5, numtemps)
DIM temphrstr$(numtemps)
DIM temphr(5, numtemps)
DIM tempminstr$(numtemps)
DIM tempmin(5, numtemps)



RESTORE TO temps



FOR counter = 1 TO numtemps STEP 1
	READ hold$
	IF LEN(hold$) = 22 THEN
		tempstr$(counter) = SUBSTR$(hold$, 19, 22)
		temp(1, counter) = VAL(tempstr$(counter))
	ELSE
		tempstr$(counter) = SUBSTR$(hold$, 19, 23)
		temp(1, counter) = VAL(tempstr$(counter))
	END IF

	tempyrstr$(counter) = SUBSTR$(hold$, 1, 4)
	tempyr(1, counter) = VAL(tempyrstr$(counter))

	tempmstr$(counter) = SUBSTR$(hold$, 5, 6)
	tempm(1, counter) = VAL(tempmstr$(counter))

	tempdstr$(counter) = SUBSTR$(hold$, 7, 8)
	tempd(1, counter) = VAL(tempdstr$(counter))
	
	temphrstr$(counter) = SUBSTR$(hold$, 9, 10)
	temphr(1, counter) = VAL(temphrstr$(counter))

	tempminstr$(counter) = SUBSTR$(hold$, 11, 12)
	tempmin(1, counter) = VAL(tempminstr$(counter))

NEXT counter

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: RESTORE TO command

Post by Mr. Kibernetik »

RESTORE TO is not for reading data from some file. It is similar to Basic RESTORE command:

Code: Select all

RESTORE TO lab
READ a
PRINT a
DATA 1
lab:
DATA 2

the_wesley_watkins
Posts: 42
Joined: Wed Jul 29, 2015 3:53 pm
My devices: Ipad
Iphone

Re: RESTORE TO command

Post by the_wesley_watkins »

Can you use multiple RESTORE TO commands with multiple labels?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: RESTORE TO command

Post by Mr. Kibernetik »

Yes.

Post Reply