isordinal
确定输入是否为有序 categorical
数组
说明
示例
确定 categorical
数组是否为有序数组
创建一个大小包含 10 个对象的 categorical
数组。对值 'S'
、'M'
和 'L'
应用名称 small
、medium
和 large
。
A = categorical({'M';'L';'S';'S';'M';'L';'M';'L';'M';'S'},... {'S','M','L'},{'small','medium','large'})
A = 10x1 categorical
medium
large
small
small
medium
large
medium
large
medium
small
确定 A
的类别是否采用数学排序。
isordinal(A)
ans = logical
0
A
不是有序数组。您必须使用函数 categorical
中的 'Ordinal',true
名称-值参数来创建有序 categorical
数组。
输入参数
A
— 输入数组
数组
输入数组。
提示
要将
categorical
数组A
从非有序转换为有序,请使用A = categorical(A,'Ordinal',true)
。要将
categorical
数组A
从有序转换为非有序,请使用A = categorical(A,'Ordinal',false)
。
扩展功能
tall 数组
对行数太多而无法放入内存的数组进行计算。
此函数完全支持 tall 数组。有关详细信息,请参阅 tall 数组。
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
此函数完全支持代码生成。有关详细信息,请参阅Code Generation for Categorical Arrays (MATLAB Coder)。
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
此函数完全支持基于线程的环境。有关详细信息,请参阅Run MATLAB Functions in Thread-Based Environment。
分布式数组
使用 Parallel Computing Toolbox™ 在集群的组合内存中对大型数组进行分区。
此函数完全支持分布式数组。有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
版本历史记录
在 R2013b 中推出R2021b: isordinal
接受任何数据类型的输入参数
isordinal
函数接受任何数据类型的输入参数。在以前的版本中,如果输入参数不是 categorical
数组,则 isordinal
会引发错误。
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)