source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/struct2arglist.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 617 bytes
Line 
1function c = struct2arglist(s)
2%STRUCT2ARGLIST  Convert structure to cell array of fields/values.
3% STRUCT2ARGLIST(S) returns a cell array {'field1',value1,'field2',value2,...}
4% It is the opposite of MAKESTRUCT.
5%
6% Example:
7%   function f(varargin)
8%   opt.FontSize = 10;
9%   opt = setfields(opt,makestruct(varargin),'ignore');
10%   varargin = struct2arglist(opt);
11%   g(varargin{:});
12%
13% See also MAKESTRUCT.
14
15% Written by Tom Minka
16% (c) Microsoft Corporation. All rights reserved.
17
18f = fieldnames(s);
19c = cell(1,2*length(f));
20for i = 1:length(f)
21  c{2*i-1} = f{i};
22  c{2*i} = s.(f{i});
23end
Note: See TracBrowser for help on using the repository browser.