Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: A Conditional File Import

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66105] Re: [mg66076] A Conditional File Import
  • From: János <janos.lobb at yale.edu>
  • Date: Sat, 29 Apr 2006 03:41:09 -0400 (EDT)
  • References: <200604281033.GAA03210@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Apr 28, 2006, at 6:33 AM, Gregory Lypny wrote:

>
>
> Hello Everyone,
>
> I'm wondering if there's a way to do a conditional import of a file
> into Mathematica.  Say I wrote some code to process a lot of data and
> it takes a long time to complete.  After it's done, I save my results
> by exporting to a text file.  When I come back later (months
> later...) to pick up where I left off, I'd like to avoid
> inadvertently, and because of poor memory, running that long script
> again if I already have the results on my hard drive (you would think
> that I'd have the sense to check first, but no).
>
> I was thinking of a script that would work something like this:
>
> If there is a file X
> 	then
> 		import the file
> 	else
> 		[message] "The darn thing doesn't exist!"
> 		Reprocess the raw data --- [message] "Better make some coffee."
> End if
>
> 	Regards,
>
> 		Greg
>

Here is a newbie approach:

SetDirectory["path_to_that_darn_thing"];

files = FileNames["*.darn"];

length=Length[files];

If[length==0,Print["The darn thing doesn't exist!"];FrontEndExecute 
[FrontEnd`HelpBrowserLookup["Gergory's_math_programs",  
"Reprocess_the_raw_data"]],];

Import["The_darn_thing"];

János


---------------------------------------------------------
What is the difference between OS X and Vista ?

Microsoft employees are exited about OS X.

http://daringfireball.net/2006/04/windows_the_new_classic




  • Prev by Date: Re: nearest neighbor
  • Next by Date: "In progress" saving of data collected using Reap/Sow
  • Previous by thread: A Conditional File Import
  • Next by thread: Re: A Conditional File Import