isscalar
确定输入是否为标量
说明
示例
从矩阵确定标量
创建一个 2×2 矩阵。确定它是否为标量。
A = [1 2; 3 4]; TF = isscalar(A)
TF = logical
0
检查矩阵第一行和第二列的元素是否为标量。
TF = isscalar(A(1,2))
TF = logical
1
字符串标量和字符向量
用双引号将一段文本括起来,由此创建一个字符串标量。确定它是否为标量。
A = "Hello, World!";
TF = isscalar(A)
TF = logical
1
现在,用单引号括起一段文本来创建一个字符向量。确定它是否为标量。
B = 'Hello, World!';
TF = isscalar(B)
TF = logical
0
使用 size
检查 B
的维度。B
不是标量,因为它的大小是 1×13。
sz = size(B)
sz = 1×2
1 13
输入参数
A
— 输入数组
标量 | 向量 | 矩阵 | 多维数组
输入数组,指定为标量、向量、矩阵或多维数组。
扩展功能
tall 数组
对行数太多而无法放入内存的数组进行计算。
此函数完全支持 tall 数组。有关详细信息,请参阅 tall 数组。
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
HDL 代码生成
使用 HDL Coder™ 为 FPGA 和 ASIC 设计生成 Verilog 代码和 VHDL 代码。
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
分布式数组
使用 Parallel Computing Toolbox™ 在集群的组合内存中对大型数组进行分区。
此函数完全支持分布式数组。有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
版本历史记录
在 R2006a 之前推出
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)