Home > src > Bridge > misc > test_structtest.m

test_structtest

PURPOSE ^

TEST_STRUCTTEST - test structtest

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 TEST_STRUCTTEST - test structtest

 AUTHOR  Ronnie Johansson
 CREATED 2004-04-29
 ALTERED

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % TEST_STRUCTTEST - test structtest
0002 %
0003 % AUTHOR  Ronnie Johansson
0004 % CREATED 2004-04-29
0005 % ALTERED
0006 %
0007 
0008 s = struct('string', 'first', 'number', -12);
0009 s(2) = struct('string', 'second', 'number', 12);
0010 s(3) = struct('string', 'third', 'number', -3);
0011 s(4) = struct('string', 'fourth', 'number', -5);
0012 s(5) = struct('string', 'fifth', 'number', 12.5);
0013 
0014 s2 = s( structtest( s, @testfunction ) ); % the testfunction
0015                                           % selects those
0016                                           % structures which have
0017                                           % positive values for
0018                                           % field 'number'
0019 
0020 s2_len = length(s2);
0021 
0022 disp('Structure 2 and 5 should be printed.');
0023 
0024 for i=1:s2_len
0025   s2(i)
0026 end

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003