[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cell{1:5}=1 not working for me!!!
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: cell{1:5}=1 not working for me!!! |
Date: |
Thu, 31 May 2012 12:00:37 -0400 |
On 31 May 2012 11:37, oxy <address@hidden> wrote:
> Sorry, I have to reformulate:
>
> The thing is, I cannot initialize a multielement cell in 1-step as i
> can do with vectors:
>
> v(1:5)=7 % v was initialized here
>
> For a cell i need 2 steps:
> c={}
> c(1:5)=7 % c must be initialized first. Cant do it in 1 step
>
> Interestingly, global vectors must also be initialized first
> and then set:
>
> global v(1:6)=9 % this will fail
>
> global v2
> v2(1:5)=7 % this will work
I'm not exactly sure what your plan is, but you can do something like
global c = num2cell(repmat(1,5,7));
or
global c = {7, 7, 7, 7, 7}
or
global c = num2cell(7*ones(1,5))
I'm not sure if you count two function calls as one step or two,
though.
- Jordi G. H.
- cell{1:5}=1 not working for me!!!, oxy, 2012/05/30
- Re: cell{1:5}=1 not working for me!!!, Jordi Gutiérrez Hermoso, 2012/05/30
- Re: cell{1:5}=1 not working for me!!!, Francesco Potortì, 2012/05/30
- Re: cell{1:5}=1 not working for me!!!, Juan Pablo Carbajal, 2012/05/30
- Re: cell{1:5}=1 not working for me!!!, Francesco Potortì, 2012/05/31
- Re: cell{1:5}=1 not working for me!!!, Jordi Gutiérrez Hermoso, 2012/05/31
- Re: cell{1:5}=1 not working for me!!!, oxy, 2012/05/31
- Re: cell{1:5}=1 not working for me!!!, Jordi Gutiérrez Hermoso, 2012/05/31
- Re: cell{1:5}=1 not working for me!!!, oxy, 2012/05/31
- Re: cell{1:5}=1 not working for me!!!,
Jordi Gutiérrez Hermoso <=
Re: cell{1:5}=1 not working for me!!!, c., 2012/05/30