"P Sherry" <pistolpetesherry@nospam.hotmail.com> wrote in message <f8l6hk$epd$1@fred.mathworks.com>...
> have an array:
>
> P{a,b}
>
> how do i find the length of P{2,b} i.e. where a is fixed and for all values of b
>
> have tried:
> sum(cellfun(@length,P)) but this does not allow for {a,b} individually
>
> thanks
> P
In article <f8lldc$h41$1@fred.mathworks.com>,
P Sherry <pistolpetesherry@nospam.hotmail.com> wrote:
>NEW PROBLEM:
>i have a loop for l and want to use it to find a value not already used in the array P{a}.
>i had the following which partly works... som of the time but not all of the time???
>for l = 1:N
> if ~any(P{2} == l-1)
>is there another form of this?
find( ~ismember( 0:N-1, P{2} ), 1 )
> there is also an inner loop i.e. P{2,b} so l-1 cannot = any of {2,:}
What is the size of P? Is it a 1 x something cell array, each
member of which is an array? Or is it a 2 x something cell array,
each member of which is an array? When you write P{2,b} do
you mean "the b'th column of the 2nd row of P", or do you mean
"the b'th element of the array P{2}" ? If P is really a 2 x something
cell array, P{2} is the same as P{2,1} .
--
Programming is what happens while you're busy making other plans.
> find( ~ismember( 0:N-1, P{2} ), 1 )
>
> > there is also an inner loop i.e. P{2,b} so l-1 cannot = any of {2,:}
>
> What is the size of P? Is it a 1 x something cell array, each
> member of which is an array? Or is it a 2 x something cell array,
> each member of which is an array? When you write P{2,b} do
> you mean "the b'th column of the 2nd row of P", or do you mean
> "the b'th element of the array P{2}" ? If P is really a 2 x something
> cell array, P{2} is the same as P{2,1} .
> --
> Programming is what happens while you're busy making other plans.
the total size of P is N (e.g. 16) but can be split over a number of columns cells in any array i.e length of P{2} = N. its hard to explain but it based on permutations so each cell may be a different size.
for P{2,b} i mean the b'th column of the 2nd row of P
have to change the code around a bit to use :
find( ~ismember( 0:N-1, P{2} ), 1 )
so il keep you updated
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.