%----------------------------------------------------------------- % % Two ways of building up a struct. Use whichever is convenient or % makes more sense to you. For me, that's the first approach. But % sometimes you need to use the second one, especially when the % struct can be built once, as opposed to building it up one % component at a time. YMMV. % %----------------------------------------------------------------- echo on; customers.name = 'Shakti'; customers.levels = [97 93 ]; customers(2).name = 'Thomas'; customers(2).levels = [94 96 ]; whos pause c = struct('name',{'Shakti','Thomas'}, 'levels',{[97 93], [94 96]}); whos pause first_customer = customers(1).name whos pause clevels = customers.levels whos pause echo off;