Prev: filter design. where is the specification info saved in Hd?
Next: Assigning transformed 2D grid of points to rows and columns
From: Martha on 7 Jul 2010 10:23 Hello! Actually how to access the structure through the variable "s" was one of the questions. But is there a way where I don't have to use the name of the original structure. Because since I have more different structures to read, which have same name of fields, but different structure name and information, I wanted to create a program to read the same fields and do some other operations for each structure. Thanks, Martha "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i0tf6o$rku$1(a)fred.mathworks.com>... > Dear Martha, > > > str1 = 'structure1'; > > s = load (str1); > > then I get > > s = structure1: [5000x1 struct] > > > > Checking the size of s and structure1, I get: > > s 1x1 623532078 struct > > structure1 5000x1 623531902 struct > > the sizes are a little bit different. > > Where does the variable "structure1" come from? The above code loads the structure from the file "structure1.mat" to the variable "s". Then the structure can be accessed by: > s.structure1 > > What exactly is your question? > > Jan
From: Steven Lord on 7 Jul 2010 10:48
"Martha " <marthao.pa(a)gmail.com> wrote in message news:i122k8$j7f$1(a)fred.mathworks.com... > Hello! > Actually how to access the structure through the variable "s" was one of > the questions. But is there a way where I don't have to use the name of > the original structure. Because since I have more different structures to > read, which have same name of fields, but different structure name and > information, I wanted to create a program to read the same fields and do > some other operations for each structure. str1 = 'structure1'; data = load(str1); Now perform your operation on each element of data.(str1) using dynamic field names. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com |