Adept Scientific - English
The world's best software for research, science and engineering.
flag arrow
clearclear
 

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Find out about Online Training
• Download a Brochure
• Request a Brochure
• Download a Demo
• Request a Demo
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 11 Professional
Maple 11 Academic
Maple 11 Student Use
Recorded Online Seminars
FREE Training Resources


MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

View Maple 10 in Action
Product Comparison Chart

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


Service & Support

Maple 10 Training Videos
MaplePrimes, blogs, forums
Elite Maintenance Program
Application Centre
Powertools
Maple User Group (MUG)
Join the Maple User Group
(MUG)

Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] Reading the Date from a txt File

Search email archive for  

[MUG] Reading the Date from a txt File
Author: Juan Navarro    Posted: Fri, 3 May 2002 10:40:30 -0500

>> From: Juan Navarro "Juan.Navarro"

I have to plot the data from a text file that contains pairs of data in the
form of [date, value]. I can read the file with

my_data:= readdata (filename, [string, float]);

but I can't plot the data.

I don't know how to process the date in Maple to plot the function. Can
somebody help?.

Thanks.

Juan Navarro-Sorroche

[MUG] Re: Reading the Date from a txt File
Author: Maple User Group    Posted: Fri, 10 May 2002 16:58:21 -0400

>> From: Maple User Group "maple_gr"

On Fri, 3 May 2002, Juan Navarro wrote:
> I have to plot the data from a text file that contains pairs of data in the
> form of [date, value]. I can read the file with
> my_data:= readdata (filename, [string, float]);
> but I can't plot the data.

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Thu, 9 May 2002 16:05:49 -0700 (PDT)
From: Robert Israel "israel"
To: "''" "maple-list"
Subject: Reading the Date from a txt File

You didn't say what format your dates are in. Whatever format it is,
fscanf or sscanf should be able to extract the month, day and year.
Then it's just a question of converting those to an integer. For example,
if all dates are between 1 Mar 1900 and 28 Feb 2100 and you take 1 Jan
2000 as day 1, you could use

> M:= [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
> f:= (month, day, year) -> (year-2000)*365+floor((year-1997)/4)+
M[month]+day + `if`(year mod 4 = 0 and month > 2, 1, 0);

Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2



-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: Stanley J Houghton "S.J.Houghton"
Date: Thu, 9 May 2002 09:01:01 +0100
To: "Juan.Navarro" "maple-list"
Subject: Reading the Date from a txt File


You need to convert your dates, which are currently strings, to
numbers. This depends of course on your date format. One way to do
it is to write a convertion proc using the string manipulation and test
routines contained in the StringTools package (see help pages).

Stan


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: "Otto C. Wilke, PhD, MATH" "owilke"
To: "maple-list"
Date: Thu, 9 May 2002 10:15:56 CST6CDT
Subject: Reading the Date from a txt File

Juan,
If someone can convert the date to a number, then you can plot as
follows. Given the text file containing

[1998,425],[1999,389],[2000,353],[2001,275],[2002,220]

Try the following

restart;f:= fopen( "C:\\My Documents\\My
Documents\\net1314\\testfile.txt" , READ, TEXT);
f := 0

> readdata(f,string);

["[1998,425],[1999,389],[2000,353],[2001,275],[2002,220]"]

> op(1,%);

"[1998,425],[1999,389],[2000,353],[2001,275],[2002,220]"

> str1:="["||%||"]";

str1 := "[[1998,425],[1999,389],[2000,353],[2001,275],[2002,220]]"

> list1:=parse(%);

list1 := [[1998, 425], [1999, 389], [2000, 353], [2001, 275],

[2002, 220]]

> p1:=plot(%,style=point,symbol=cross,symbolsize=30):
> with(plots):display({p1},labels=[Year,Summer_Enrollment]);

There is surely a more elegant way to do this.
Otto Wilke

Previous by date: [MUG] declaration of procedure-type, Stefano Sofia
Next by date: [MUG] plot after assume, Matthias Kawski
Previous thread: [MUG] PostScript Bug in Maple 6.02a Win 2k Pro,  Jeff Wright
Next thread: [MUG] plot after assume, Matthias Kawski



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055