Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: labeling issue dumb programming
Date: Wed, 4 Nov 2009 11:19:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <hcrnv6$iik$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257333542 19028 172.30.248.38 (4 Nov 2009 11:19:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 11:19:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2076242
Xref: news.mathworks.com comp.soft-sys.matlab:582324


I have a problem with discrete functions and labeling

In my program I collect a vector of different lengths say, x=[1 1 2 3 1.4142 2.2361 2.2361 8]

Length 1 and 2.2361 occurs 2 times and I would like to use this in the following manner...

I have a associated vector v, which stores all possible lengths (in 3D)
v=[1.0000   1.4142 1.7321 2.0000 2.2361 2.4495 2.8284...]

and I write the occurences of X as
X=[2 1 0 1 2 0...] which has the same length as v.
I read out X as (together with v) 1.0000 occurs 2 times,  1.4142 occurs 1 time, 1.7321 occurs 0 times and so forth...

But the problem is that to be able to create X I must loop over all possible lengths in v and check how many times they occur in x. This just does not seem right as it will be a very slow process. This seem to be a standard question, and I wonder if there there are functions to handle these types of questions/labeling issues? Any ideas would be highly appreciable.

Best regards!
  Jimmy