Path: news.mathworks.com!not-for-mail
From: Edric M Ellis <eellis@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: histc for gpu
Date: Thu, 20 Feb 2014 07:56:02 +0000
Organization: The Mathworks, Ltd.
Lines: 40
Message-ID: <ytweh2y9q0d.fsf@uk-eellis-deb7-64.dhcp.mathworks.com>
References: <lc1a97$6tt$1@newscl01ah.mathworks.com>
	<ytwmwihkabl.fsf@uk-eellis0l.dhcp.mathworks.com>
	<ldnu6b$t2e$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: uk-eellis-deb7-64.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: newscl01ah.mathworks.com 1392882963 2038 172.16.21.215 (20 Feb 2014 07:56:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 20 Feb 2014 07:56:03 +0000 (UTC)
X-Face: $Ahg}Iylezql"r1WV1Me5&)ng"a4v%D>==KMs-elCfj"o}$bh-VOt7lVXgLWsC?9mZ`mINT
 G6PDvca;nrgs$lfcr0l1ew'N]>nXKl}m|Zpg>,6*gLp~-N0N2*+b.iwv=u>@R$L4SEG&NYUU;lSR@u
 IHphdAy
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock: sha1:YXKQdoZl116ITnLsWP+8KVI+zDU=
Xref: news.mathworks.com comp.soft-sys.matlab:809603

"Christian " <proechri@umich.edu> writes:

>> [...]
>
> Thanks, Edric. I have some trouble getting your code running. I've set up a function file:
>
>    function b = bindata(x,edges)
>        nEdges = 100;
>        b = 0;
>        if x == edges(end)
>            b = nEdges;
>        else
>            for idx = 1:(nEdges-1)
>                if x >= edges(idx) && x < edges(idx + 1)
>                    b = idx;
>                    break;
>                end
>            end
>        end
>    end
>
> I changed nEdges=numel(edges) to just the size of edges because the
> arrayfun command didn't like numel. But still when running the code
> from my main file using
>
> indx = arrayfun(@bindata, xpgpu, x_gridgpu);
>
> I receive the message
> Error using gpuArray/arrayfun
> Indexing is not supported.
> for lines 4 and 8. 

Which version of MATLAB/PCT are you using? You need at least R2013a to
use indexing within ARRAYFUN. See

http://www.mathworks.co.uk/help/distcomp/release-notes.html

Cheers,

Edric.