Autoimport

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Automatically reads specified file. Handles standard file types.

Synopsis

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

Description

Automatically identifies a filetype and calls the appropriate reader. If no file name (filename) is provided, the user is prompted for a desired filetype to browse for. If no file name is provided but a specific file type is provided, the user is prompted for a file of the given type. If both a filename and a method name are provided, the given file will be loaded using the specified method disregarding the file extension.

Input (methodname) can be any valid importer method name (method types / file extensions) a list of which can be retrieved using the command:

    autoimport('methods')

Optional input (options) is described below.

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).
  • defaultpromptmethod : [{' '}] Default method displayed when using 'prompt' importing.
  • importmethod : [{'editds_defaultimportmethods'}|'editds_imgimportmethods'|functionName] Function to get import method list from.
  • 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

autoexport, experimentreadr, imageload, jcampreadr, parsexml, spcreadr, xclreadr, xyreadr