[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trouble indexing cell array
From: |
c. |
Subject: |
Re: trouble indexing cell array |
Date: |
Mon, 5 Nov 2012 08:15:13 +0100 |
On 5 Nov 2012, at 01:09, Ben Abbott wrote:
> On Nov 4, 2012, at 7:04 PM, Tim Meehan wrote:
>
>> I'm having a strange problem shown below. I want to take a subset of a cell
>> array and save it as a new variable. I can index the subset just fine, but
>> when I try to save the subset into a new variable, it saves as only one
>> element in the array. I'm mystified, can anyone tell me what I'm doing wrong?
>>
>> octave:326> filenames{2:10}
>> ans = _L_V1d.mat
>> ans = _L_V1v_vox.mat
>> ans = _L_V2d.mat
>> ans = _L_V2v_vox.mat
>> ans = _L_V3.mat
>> ans = _L_V3A_dors.mat
>> ans = _L_V3A_vox.mat
>> ans = _L_V4_vox.mat
>> ans = _L_VP_vox.mat
>> octave:327> test = filenames{2:10}
>> test = _L_V1d.mat
>
> Add a set of curly brackets around the cs-list
>
> test = {filenames{2:10}}
>
> Ben
Or use parenthesis for indexing instead of curly braces:
test = filenames(2:10)
HTH,
c.