From: Darnell on 6 Aug 2010 13:04 I am working with data that is saved as numeric integer mat files like 1.mat, 2.mat, 3.mat etc. In each of the mat files, there about 20 variables. I am trying to write a loop that will access all of the mat files but only load into the workspace one variable from each file, 'Xa'. From the other post regarding loading multiple files I've seen responses that suggest using code such as: C = cell(1,numberoffiles ); for m = 1:numberoffiles C{m} = load(sprintf('%d.', m)); end This code works well if you want to load the entire mat file but I only want to load one or two variables that are repeated in all of the files. Any suggestions will be greatly appreciated. Thanks! -- Darnell
From: Steven_Lord on 6 Aug 2010 13:05 "Darnell " <dxs_biomech(a)yahoo.com> wrote in message news:i3hfa4$m8d$1(a)fred.mathworks.com... > I am working with data that is saved as numeric integer mat files like > 1.mat, 2.mat, 3.mat etc. In each of the mat files, there about 20 > variables. I am trying to write a loop that will access all of the mat > files but only load into the workspace one variable from each file, 'Xa'. > > From the other post regarding loading multiple files I've seen responses > that suggest using code such as: > > C = cell(1,numberoffiles ); > for m = 1:numberoffiles > C{m} = load(sprintf('%d.', m)); > end > > This code works well if you want to load the entire mat file but I only > want to load one or two variables that are repeated in all of the files. > Any suggestions will be greatly appreciated. Thanks! Look at the first two-input syntax given in the help for LOAD. -- 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
|
Pages: 1 Prev: interpolation NaN data at 3D array Next: Why very different running time for similar codes ? |