Autoimport

From Eigenvector Research Documentation Wiki
Revision as of 09:19, 2 September 2008 by imported>Jeremy (Importing text file)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

Automatically reads specified file. Handles all standard filetypes.

Synopsis

autoimport(filename,methodname,options)
[data,name,source] = autoimport(filename,methodname,options)

Description

Automatically identifies a filetype and calls the appropriate reader. If no filename is provided, the user is prompted for a desired filetype to browse for. If no filename is provided but a specific filetype is provided, the user is prompted for a file of the given type. If output is requested, the loaded item(s) is/are returned as a single output. If no outputs are requested, the items are loaded into the base workspace or other action as defined by the options structure.

Options

  • options = a structure array with the following fields:
  • target: [ {'workspace'} | 'analysis' | 'editds'] Target for file load. If 'workspace', file contents are loaded into base workspace (the default behavior). If 'analysis', file contents are automatically dropped into an empty Analysis GUI interface. If 'editds', file contents are loaded into a DataSet editor.
  • defaultmethod: [{'prompt'} | 'string' | 'error' | methodname ] governs how to handle input (filename) when no recognizable file extension can be found. 'prompt' prompts the user to identify the appropriate importer, 'string' interprets the input as a string, 'error' returns an error. Any other valid methodname can also be provided (use autoimport('methods') to get list of valid methods),
  • error: [ 'error' | {'gui'} ] governs how to handle errors during imports. 'error' returns an untrapped error, 'gui' traps the error and presents an error dialog to the user.

See Also

imageload, jcampreadr, parsexml, spcreadr, xclreadr, xyreadr