Prev: variable size inputs/outputs
Next: DWT 3Dplot
From: Brad on 16 Jul 2010 12:12 Hi all, Does anyone know a quick way to do something like a([2,2,2])=a([2,2,2])+1; and get a(2)==3 (assuming it was initially 0) as opposed to a(2)==1. Sorry if this is an FAQ but my search of the archive didn't come up with the answer. Brad
From: Walter Roberson on 16 Jul 2010 13:56 Brad wrote: > Does anyone know a quick way to do something like > a([2,2,2])=a([2,2,2])+1; and get a(2)==3 (assuming it was initially 0) > as opposed to a(2)==1. a = a + accumarray([2 2 2].', 1);
From: Andy on 16 Jul 2010 14:05 % Did you intend to do this: a = [2 2 2]; a=a+1 % displays: a = [3 3 3]
|
Pages: 1 Prev: variable size inputs/outputs Next: DWT 3Dplot |