From: Ashley on
I have data thats in a cell in form of doubles, and depending on the data set, the length of this cell can range from about 20 to over 100. I need to access the contents of this cell array individually. I know how I can do this using deal, as in the example from doc:

[a,b,c,d] = deal(C{:})

My question: is there a method for automatically creating an array like [trial1 trial2 trial3 ... trial99] for varying lengths (that are specific to the cell length, of course) without actually doing it manually each time?

Sorry if it's confusing...

Thanks in advance!

Ashley
From: James Tursa on
"Ashley " <namehere(a)thisplace.com> wrote in message <hpo29c$n7l$1(a)fred.mathworks.com>...
> I have data thats in a cell in form of doubles, and depending on the data set, the length of this cell can range from about 20 to over 100. I need to access the contents of this cell array individually. I know how I can do this using deal, as in the example from doc:
>
> [a,b,c,d] = deal(C{:})
>
> My question: is there a method for automatically creating an array like [trial1 trial2 trial3 ... trial99] for varying lengths (that are specific to the cell length, of course) without actually doing it manually each time?

No. The actual data in each of the cells is physically in different parts of memory. When you concatenate some or all of them into a single variable you have to copy all of the individual data contents into a new single block of memory. That can only be done by manually doing it each time. The alternative is to copy *everything* to one array and then access slices of that array. This latter approach has the advantage that it will ultimately will be faster to access your data this way than concatenating the individual cells each time.

James Tursa
From: Ashley on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hpo3il$d9o$1(a)fred.mathworks.com>...
> "Ashley " <namehere(a)thisplace.com> wrote in message <hpo29c$n7l$1(a)fred.mathworks.com>...
> > I have data thats in a cell in form of doubles, and depending on the data set, the length of this cell can range from about 20 to over 100. I need to access the contents of this cell array individually. I know how I can do this using deal, as in the example from doc:
> >
> > [a,b,c,d] = deal(C{:})
> >
> > My question: is there a method for automatically creating an array like [trial1 trial2 trial3 ... trial99] for varying lengths (that are specific to the cell length, of course) without actually doing it manually each time?
>
> No. The actual data in each of the cells is physically in different parts of memory. When you concatenate some or all of them into a single variable you have to copy all of the individual data contents into a new single block of memory. That can only be done by manually doing it each time. The alternative is to copy *everything* to one array and then access slices of that array. This latter approach has the advantage that it will ultimately will be faster to access your data this way than concatenating the individual cells each time.
>
> James Tursa


Thanks, you've saved me a few hours.

I actually separated the data and put them into nonuniform cells (that's the only way I know how to separate data based on something without having to do it for each new data set) based on the trial number, so i'd like to keep the data separated because I need to manipulate the data within a trial - separate from the other trials. Is there a more efficient way of doing this?

*fyi: trial - from doing a repeated task

Thanks in advance!

Ashley
From: Ashley on
"Ashley " <namehere(a)thisplace.com> wrote in message <hpoa6f$l41$1(a)fred.mathworks.com>...

> Thanks, you've saved me a few hours.
>
> I actually separated the data and put them into nonuniform cells (that's the only way I know how to separate data based on something without having to do it for each new data set) based on the trial number, so i'd like to keep the data separated because I need to manipulate the data within a trial - separate from the other trials. Is there a more efficient way of doing this?
>
> *fyi: trial - from doing a repeated task
>
> Thanks in advance!
>
> Ashley

I found a way to extract it to a double in separate columns. Problem solved!

Ashley