Cody

# Problem 2037. Insert structure in a parameter-cell array.

Solution 365953

Submitted on 6 Dec 2013 by Alfonso Nieto-Castanon
• Size: 38
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = {'string','blah',struct('position',[10 10 100 20]),'tag','me'}; y = mix2cell(x); y_correct = {'string','blah','position',[10 10 100 20],'tag','me'}; assert(isequal(y,y_correct))

2   Pass
%% x = {'string','blahblah','tag','me'}; y = mix2cell(x); y_correct = {'string','blahblah','tag','me'}; assert(isequal(y,y_correct))

3   Pass
%% x = {'string','blah',struct('value',rand(100),'backgroundcolor',[1 0 1]),'tag','me too',struct('foregroundcolor',[0 1 0.5])}; y = mix2cell(x); y_correct = {'string','blah','value',x{3}.value,'backgroundcolor',[1 0 1],'tag','me too','foregroundcolor',[0 1 0.5]}; assert(isequal(y,y_correct))

4   Pass
%% x = {'string','blah',struct('string','blahblah'),'string','',struct('string','this one')}; y = mix2cell(x); y_correct = {'string','blah','string','blahblah','string','','string','this one'}; assert(isequal(y,y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!