|
From: | Ben Abbott |
Subject: | Re: Loading variables from file into struct or cell-array |
Date: | Thu, 23 Oct 2008 07:30:49 -0400 |
On Oct 23, 2008, at 7:23 AM, Jan Albersmeyer wrote:
Hi ! Is there a way to load variables from a file directly into a struct, such that e.g. the vars "v1","v2", from the file ... are stored in memory as "input.v1", "input.v2", .... Of course without knowing them in advance ;-)Or is there a possibility to get an array of the strings of the variablenames contained in a file ( i.e. something like a table of contents), such one can iterate through them ? Thanks, Jan
To load the variables of a file into a structure, input = load ("yourfile"); For an array of strings variable_names = fieldnames (load ("yourfile")); To see the "table of contents" disp (char (variable_names) Ben
[Prev in Thread] | Current Thread | [Next in Thread] |