|
"Greg von Winckel" <gregvw@gmail.com> wrote in message
<fjocab$nqi$1@fred.mathworks.com>...
> I had this bit of code which used to work in a previous
> version of MATLAB but no longer functions in the current
> version
>
> for k=1:n
> [q{k},w{k}]=rquad(N,k-1);
> end
>
> [Q{1:n}]=ndgrid(q{:}); [W{1:n}]=ndgrid(w{:});
>
> clear q w; q=zeros(Nn,n); w=q; X=q;
>
> for k=1:n
> q(:,k)=reshape(Q{k},Nn,1); w(:,k)=reshape(W{k},Nn,1);
> end
>
> map=eye(m); map(2:m,1)=-1; c=map*vert;
> W=abs(det(c(2:m,:)))*prod(w,2);
>
> for k=1:n-1
> X(:,k)=(1-q(:,k)).*prod(q(:,1:k-1));
> end
>
> which now gives the error
>
> ??? Error using ==> times
> Matrix dimensions must agree.
>
> Error in ==> nsimplexquad at 37
> X(:,k)=(1-q(:,k)).*prod(q(:,1:k-1));
>
>
> It seems that now ndgrid only returns the first argument. Is
> there a workaround?
>
> Thanks,
> Greg
>
I am not sure, but could it be that
[C{1:n}] = ndgrid(q{:})
is interpreted (wrongly) as
[C{1:n}] = deal(ndgrid(q{:}))
??
Jos
|