I went to a particular website where I downloaded Maple programs in .txt files.
If I open the files and cut and paste the .txt into a Maple worksheet,
a > is inserted at the start of every line. It would take forever to delete each of these
>'s from the start of each line in a program with 500 lines. Someone suggested that I put the command
read C:\\filename.txt
into my Maple worksheet. But, this - and many variations, with and without single quotes, file extensions, etc. - does not work.
Any suggestions?
By the way: I never expect more than 1% of suggestions and help with computer programming ever to work. That's about the average. That's just the way computers and their software are made.
read txt file
I have eg a file J:\temp\maple\q.txt with these lines:
and both
or
produce this output:
2 f := proc(x) x^2 end proc 2 aAs an alternative, eg if I have a txt file with prompts, J:\temp\maple\q2.txt say, with lines:
I can do, from the Classic GUI menu, File > Open > Type: Maple Text , select q2.txt , Text Format Choice > Maple Text, and a worksheet q2.txt opens with the above lines.
In Standard GUI, similarly, File > Open > Files of type: Text (.txt), select q2.txt, Open > Maple Text (in Text Format Choice).
Alternatively, in Standard GUI, File > Open > Files of type: Text (.txt), select q.txt, Open > Maple Input (in Text Format Choice), and I get a worksheet q.txt with those same input lines (ie from a txt file without ">"s).
Worked (sort of)
Thank you. I did made a test file as you and another suggested. I successfully read that into my Maple document. I find it odd that the syntax is
read "C:/directory/filename.txt":
or whatever, with the forward slashes, even though everywhere else directories use backslashes. Both single quotes and double quotes worked. I said "sort of", in the subject line above, because even though I successfully "read in" the particular free Maple programs I had downloaded from a particular math researcher's website, I cannot get his programs to run. Only the "header" is printed it out. It takes too long to explain here
rename file?
One thing to try is this:
If the file is named
"file.txt" then try renaming it "file.mw" or maybe "file.mws". Next try to open it with Maple like any other mw file.
I often see students change the extension of their Maple files to .txt because our email system blocks files with extension .mw. They email the file with the txt extension, save it, then change the name back to mw.
The file extension change thing
I know that that file extension name change trick works in many situation. But not this one. If I recall, when one changes .txt to .mw, a > is inserted at the start of every line, each of which must be removed manually. Very tedious for large files.