LoadFromFile

  Copyright (C) 2009-2016 Peter Rakyta, Ph.D.
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see http://www.gnu.org/licenses/.

Description

Returns a class to load variables from a file.

Syntax

interface = LoadFromFile( filename )

Parameters
filename A string containing the path to the file. In octave use absolute path only.

Attributes (protected)

  • LoadedVariable

    structure containing the loaded data.
  • filename

    String containing the path to the loaded file.

Methods (public)

LoadFromFile::LoadVariable

Loads a variable from the opened file.

Syntax

ret = object.LoadVariable( varname )

Parameters
varname The name of the variable.
varargin Optional parameters given by a sequance ...'name', value,... . Possible parameters are the following:
  • NoEmpty

    Set true for throw an error when the loaded variable is empty.
  • StructName

    String containing the name of a structure, when the wanted variable is a field of a loaded structure.

Return
ret The value of the loaded variable.



LoadFromFile::setLoadedVariable

Set a loaded variable.

Syntax

object.setLoadedVariable( varname, value, varargin )

Parameters
varname The name of the variable.
value The value to be set.
varargin Optional parameters given by a sequance ...'name', value,... . Possible parameters are the following:
  • NoEmpty

    Set true for throw an error when there is no loaded variable with the given name.
  • StructName

    String containing the name of a structure, when the given variable is a field of a loaded structure.



LoadFromFile::SaveLoadedVariables

Saves the loaded variables.

Syntax

object.SaveLoadedVariables( varargin )

Parameters
varargin Optional parameters given by a sequance ...'name', value,... . Possible parameters are the following:
  • filename

    A string containing the path to the new file to be created instead of the original one.



LoadFromFile::ClearLoadedVariables

Disposes the loaded file.

Syntax

object.ClearLoadedVariables( varargin )