Date: May 10, 2013 1:11 PM
Author: dpb
Subject: Re: get struct field including empty values

On 5/10/2013 10:44 AM, John wrote:
> I have conducted an experiment and saved all trials as a structure with
> relevant parameters as fields.
>
> If I only want to use the correct trials, I am using:
> indices = find([allData.correct]==1);
>
> However, It is only now (that I am using this strucure with over 30'000
> trials that I discover that this works incorrectly when some of the
> field values are empty or not a number.
> Then length(allData.correct) < length(allData)
>
> How do I obtain an array of all the trials values of a specific field,
> which is representive with respect to the index number?


The index returned by find() will still be representative of the actual
position; it simply is condition by the logical expression you have used
in the search to (correctly) not return values that don't match the
condition.

If you want all members of a field, then don't put a conditional test on
it; simply

x=allData.xVarFieldName;

And, of course, you don't need the new variable necessarily, just
reference what you want.

If that doesn't suit, post more details of why there was any question on
this to begin with as I'm somewhat puzzled by what seems to be obvious...

--