My guess is that the scancode for deleting the matrix is still detected for a few milliseconds after the matrix has been deleted, i.e. it tries to delete the matrix a second time and then you get the error. A simple solution is to check that the matrix exists before deleting it as in the following which works for me:
do
text 0,100,"1 build, 2 if delete, 3 save, 4 load, 5 exit"
text 0, 120, str$(matrix exist(1))
`move()
if keystate(2)
input "matrix breite(x)",mx#
input "matrix tiefe(z)",mz#
input "matrix kachelzahl(x)",kx
input "matrix kachelzahl(z)",kz
make matrix 1,mx#,mz#,kx,kz
endif
if keystate(3)
if matrix exist(1) then delete matrix 1
endif
if keystate(4)
` savematrix(mx#,mz#,kx,kz)
endif
if keystate(5)
input "Load:",filename2$
` loadmatrix(filename2$)
endif
if keystate(6)
end
endif
loop
[Edited spelling.

]