compare length of arrays in a cell
Ältere Kommentare anzeigen
good morning, I have acell array and i want to compare cell's length. Till now I used just t compare the equality of the cells using:
isequal(A{1,:})
A is the cell array.
I tried to run
isequal(length(A{1,:}))
but that's not correct.
What is the easiest way to achieve that, without using a or cycle???
Thanks
6 Kommentare
Andrew Newell
am 12 Mär. 2015
Could you give an example of A?
Adam
am 12 Mär. 2015
Do you really mean cell length or cell size? length is just whichever of the size dimensions is the larger, size is the full measure incorporating all dimensions.
ludvikjahn
am 12 Mär. 2015
Bearbeitet: ludvikjahn
am 12 Mär. 2015
per isakson
am 12 Mär. 2015
Do you really mean
A=[1x215 cell
1x215 cell
1x215 cell]
and not
A={1x215 cell
1x215 cell
1x215 cell}
?
ludvikjahn
am 13 Mär. 2015
Adam
am 13 Mär. 2015
Isn't this basically the same question you asked before?:
Akzeptierte Antwort
Weitere Antworten (1)
per isakson
am 12 Mär. 2015
Bearbeitet: per isakson
am 12 Mär. 2015
A hint based on some guessing
cac = {'abc','def', 'ghi'};
tmp = cellfun( @length, cac, 'uni', false );
isequal( tmp{:} )
returns
ans =
1
I failed to make a one-liner
 
Addendum
A variant more in line with the comments to the question
cac = {'abc','def', 'ghi'};
cac = { cac, cac, cac };
tmp = cellfun( @length, cac, 'uni', false );
isequal( tmp{:} )
returns
ans =
1
2 Kommentare
ludvikjahn
am 12 Mär. 2015
Bearbeitet: ludvikjahn
am 12 Mär. 2015
per isakson
am 12 Mär. 2015
Bearbeitet: per isakson
am 12 Mär. 2015
Kategorien
Mehr zu Cell Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!