No BSD License  

Highlights from
collapse.m

4.0

4.0 | 1 rating Rate this file 1 Download (last 30 days) File Size: 1014 Bytes File ID: #10005

collapse.m

by Gerald Dalley

 

15 Feb 2006 (Updated 21 Feb 2006)

Removes degenerate portions of a cell array tree.

| Watch this File

File Information
Description

%c = collapse(c)
% Takes a recursive cell array as a tree and collapses any branches
% having a fanout of 1. Any elements with fanout of 0 are removed.
%
%Examples:
% collapse({1 2 3}) --> {1 2 3}
% collapse({{1} {2} {{3}}}) --> {1 2 3}
% collapse({1 {2 3}}) --> {1 {2 3}}
% collapse({1 {{} 2 {{}} 3}}) --> {1 {2 3}}
% collapse({{{}}}) --> {}
%
% [matches] = regexp({'abc', 'def', 'fghi'}, '[^f]*f+[^f]*', 'match');
% collapse(matches) --> {'def' 'fghi'}
%

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
18 Feb 2006 John D'Errico

Good documentation, it does what it claims to do.

Please login to add a comment or rating.
Updates
21 Feb 2006

Removed boilerplate copyright.

Tag Activity for this File
Tag Applied By Date/Time
structures Gerald Dalley 22 Oct 2008 08:15:55
cell arrays Gerald Dalley 22 Oct 2008 08:15:55
tree Cristina McIntire 23 Feb 2009 15:36:29
cell Cristina McIntire 23 Feb 2009 15:36:29
collapse Cristina McIntire 23 Feb 2009 15:36:29
branch Cristina McIntire 23 Feb 2009 15:36:29

Contact us at files@mathworks.com