Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: loop for find

$
0
0
dpb <none@non.net> wrote in message <kqhqsp$p96$2@speranza.aioe.org>...
> On 6/27/2013 11:44 AM, fmri wrote:
> > dpb <none@non.net> wrote in message <kqhojh$jal$1@speranza.aioe.org>...
> ...
>
> >> The loop is easy enough...
> >>
> >> for i=1:75
> >> ind(i)={find(trial==i)); % use a cell array as lengths will differ
> >> end
> >>
> >> And, w/o a loop (untested)...
> >>
> >> ind= arrayfun(@(x)(find(trial==x)), x, 'UniformOutput', false);
> >>
> >> --
> >
> > Hi dpb,
> > I got the error :
> > In an assignment A(I) = B, the number of elements in B and I must
> > be the same.
> >
> > Error in stillworking_with_for (line 11)
> > ind(i)=find(trial==i); % use a cell array as lengths will
> > differ
> ...
>
> Well, you didn't do what I told you to do..._USE_ a cell array because
> the lengths _WILL_ be different. Look at your code above in comparison
> to my example carefully.
>
> "Use the curlies, Luke..."
>
> --

I did not get it. u mean create a cell array that has one word and has a length equals to trial ?

I really appreciate yr answers but why I am feeling every time that u answer or replay, u want to eat me ( yr writing implies this ) . I think if I was in front of view, I would quite what my job. I am a basic ( beginner ) ( baby ) matlab user so I hope u understand this. Thanks anyway!!

Viewing all articles
Browse latest Browse all 19628

Trending Articles