| MATLAB Function Reference | ![]() |
Syntax
D = cellfun('fname',C)D = cellfun('size',C,k) D = cellfun('isclass',C,classname)
Description
對陣列格 D = cellfun('fname',C)
C 中的每個元素執行函式 fname 運算,回傳一個浮點數陣列 D。D 中的元素為 C 中元素經 fname 運算後的結果。D 的維度與 C 相同。
| Function |
Return Value |
isempty |
空陣列格元素為真 |
|
邏輯陣列格元素為真 |
|
實數陣列格元素為真 |
length |
陣列格元素的長度 |
|
陣列格元素的維度 |
|
陣列格元素裡的元素個數 |
D = cellfun(' 回傳 size',C,k)
C 的第 k 維度的元素大小。
D = cellfun('isclass',C,' 若 classname')
C 中的元素與類別名稱 classname 相同,則回傳真(true)。若物件中有次類別名稱為 classname,此函式回傳偽(false)。
Limitations
若陣列格中包含物件,cellfun 無法呼叫多重定義的 fname。
Example
C{1,1} = [1 2; 4 5];
C{1,2} = 'Name';
C{1,3} = pi;
C{2,1} = 2 + 4i;
C{2,2} = 7;
C{2,3} = magic(3);
D = cellfun('isreal',C)
D =
1 1 1
0 1 1
len = cellfun('length',C)
len =
2 4 1
1 1 3
isdbl = cellfun('isclass',C,'double')
isdbl =
1 0 1
1 1 1
See Also
isempty, islogical, isreal, length, ndims, size
| celldisp | cellplot | ![]() |