Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matching Character Phrases...
Date: Fri, 22 Feb 2008 16:16:36 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <fpmsh4$nmi$1@fred.mathworks.com>
References: <fpkn42$3cg$1@fred.mathworks.com> <47bee1bc$0$294$b45e6eb0@senator-bedfellow.mit.edu> <fpmp0i$fi6$1@fred.mathworks.com> <47beebf4$0$287$b45e6eb0@senator-bedfellow.mit.edu>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1203696996 24274 172.30.248.35 (22 Feb 2008 16:16:36 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 22 Feb 2008 16:16:36 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1138100
Xref: news.mathworks.com comp.soft-sys.matlab:453176



> Once you have locationStruct and distanceStruct, there are lots of ways to
> create the arrays. What's most efficient depends on the number of "single"
> words, but here's what I think is a relatively robust solution:
> 
> numWords = sum( ~structfun(@numel, locationStruct) );
> wordList = cell(numWords, 1);
> distanceList = zeros(numWords, 1);
> count = 0;
> fn = fieldnames(distanceStruct);
> for i=1:numel(fn)
>     word = fn{i};
>     for distance=distanceStruct.(word)
>         count = count + 1;
>         wordList{count} = word;
>         distanceList(count) = distance;
>     end
> end
> 

Thanks again!!

I have tested this code, and it seems 'wordlist' contains every possible word. 
Is there a way to just show the words that match in an array?

Also, distanceList seems to be full of the mostly same number... For the 
ciphertext I tested it on, it shows as mostly '480'. Is there a way of this array 
showing the distances between matches? (i.e. 45, 95, 105, 25 etc... (or 
whatever the values may be)).

We are so nearly there though, thanks so much for all the effort!!